1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  4. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Spell] Adding Gold Cost to custom Spell

Discussion in 'World Editor Help Zone' started by Tompoolk, Sep 6, 2012.

  1. Tompoolk

    Tompoolk

    Joined:
    Apr 14, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    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.
     
  2. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Use "Charge Gold and Lumber" as the base ability.
     
  3. Tompoolk

    Tompoolk

    Joined:
    Apr 14, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    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: Sep 6, 2012
  4. bisnar13

    bisnar13

    Joined:
    May 1, 2011
    Messages:
    526
    Resources:
    26
    Models:
    20
    Icons:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    26
    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 :)
     
  5. Tompoolk

    Tompoolk

    Joined:
    Apr 14, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    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: Sep 7, 2012
  6. helekiller

    helekiller

    Joined:
    Aug 5, 2011
    Messages:
    99
    Resources:
    0
    Resources:
    0
    that would be an integer comparison
     
  7. Spartipilo

    Spartipilo

    Joined:
    Jul 14, 2011
    Messages:
    3,190
    Resources:
    0
    Resources:
    0
    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.
     
  8. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    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...
     
  9. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    I don't know is it only me or is it the native script requires JNGP to compile.
     
  10. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    you cant declare a native in a non-JNGP environment...
     
  11. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,843
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    what about adding some if then elses then if the gold is insufficient,remove then add ability!
     
  12. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    So he HAVE to get a JNGP ?
    Aw shi--
     
  13. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    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

    )
     
  14. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,843
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    uhhmm that cannot be cancelled if you stop it.
    The effective way is this:
    • Unit - Remove (Spell)
    • Unit - Add (Spell)
    • Unit - Set Level of Spell to Spell_Level
     
  15. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    Oh, yeah, you're right!
    (How about "Unit begins casting an ability"?)
     
  16. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,843
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    that cannot be read or cannot be called
     
  17. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    What do you mean?

    (I have used the "stop" order, and it works... for a non-trigger spells)
     
  18. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,843
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    See!
     
  19. Tompoolk

    Tompoolk

    Joined:
    Apr 14, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Finally done it! Thanks to everyone who posted help, I don't think I could've done it without you.