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 havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Dismiss Notice
  4. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  5. Dismiss Notice
  6. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  7. 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.

[JASS] {idea} [vJass] (System) CustomAttack

Discussion in 'Triggers & Scripts' started by Anachron, Apr 19, 2010.

  1. hell gate

    hell gate

    Joined:
    Nov 23, 2008
    Messages:
    477
    Resources:
    10
    Models:
    1
    Spells:
    9
    Resources:
    10
    oh yes what will happen with auras or items that incraise attack speed or damge?
     
  2. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    The damage is easy, but the attack speed... i think it will need to be artificial.
     
  3. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,193
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    I'll just trigger the attackspeed.
     
  4. supertoinkz

    supertoinkz

    Joined:
    Dec 29, 2008
    Messages:
    2,813
    Resources:
    25
    Models:
    15
    Icons:
    7
    Maps:
    1
    Tutorials:
    2
    Resources:
    25
    Awesomesauce :D
    Can't wait for this.
     
  5. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,193
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Ok seems like I really have to do this system :D
     
  6. Catch_ya

    Catch_ya

    Joined:
    May 21, 2009
    Messages:
    982
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Of course. You started it, you gotta finish it. Else you aren't the real Anachron.
     
  7. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,193
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    I am but reallife is eating me up ):
     
  8. Catch_ya

    Catch_ya

    Joined:
    May 21, 2009
    Messages:
    982
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Sad, I feel with you.
     
  9. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,193
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Code (vJASS):

    library test initializer init requires CustomAttack

        globals
            private unit priest = null
            private unit ghul   = null
        endglobals
       
        private function initAttackData takes nothing returns nothing
            local CustomAttack ca = CustomAttack.create('hmpr') // Create an attack for the priest
           
            set ca.dmg = 7 // base dmg
            set ca.dmgDiceAmount = 1 // One dice
            set ca.dmgDiceMax = 2 // Max number
            set ca.hasMissile = true // Whether the attack has a missile or not
            set ca.damageType = DAMAGE_TYPE_MAGIC // Damagetype
           
            set ca.missile.sfx = ""
            set ca.missile.height = 50
            set ca.missile.moveSpeed = 500
            set ca.missile.turnSpeed = 1.
            // Whatever you want
            /*
            set ca.missile.xyArc = 0.22 // 22% Arc on xy-level
            set ca.alpha         = 155 // 50% visible
            */

        endfunction
       
        private function init takes nothing returns nothing
            // Create some example units
            set priest = CreateUnit(Player(0), 'hmpr', 0, 0, 0)
            set ghul = CreateUnit(Player(PLAYER_NEUTRAL_ENEMY), 'ughl', 0, 0, 0)
           
            // Initialize all attack values
            call initAttackData()
           
            // Attacks the ghul using the attackdata
            // of the priest, which is loaded automatically
            call CustomAttack.new(priest, ghul)
        endfunction
    endlibrary

     

    A little example code how to recreate the priest attack with my engine.
     
  10. Axarion

    Axarion

    Joined:
    Sep 30, 2009
    Messages:
    675
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Looks right now really nice :) But maybe add an example for heroes coz its much harder to calculate that damage^^
     
  11. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,193
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    I am thinking about how I should do it with heroes.
    I guess I will make an extra function for it. (Which checks for primary attribute) or so.
     
  12. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    how do you detect which unit is attacking? when you 'get' that unit you can extract the attribute o_O. but you have to make a customisable variable that "defines" the attribute influence on damage in case of heros.
     
  13. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,193
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Yes, I make a setup area for the damage of heroes.

    I detect which unit is attacking by triggering everything, from the attackstart up to the finished attack withing the damage dealing of the attack.
     
  14. Catch_ya

    Catch_ya

    Joined:
    May 21, 2009
    Messages:
    982
    Resources:
    1
    Spells:
    1
    Resources:
    1
    About the hero damage, hero get extra damage from strength, agility or intelligence all after what their primary attribute is. At the advanced gameplay constants there is a line called "Damage per attribute" it is 1.0 or something. You should make a global that has the same name. All other gameplay constants that influences attacking and or damaging from attacks should be a configurable global as well. With the right formula it is easy to calculate hero damage.
     
  15. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,193
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Yes, that was exactly what I was thinking about.
    By the way, the first beta of this system will not be far away, it's going everything very well.
     
  16. Catch_ya

    Catch_ya

    Joined:
    May 21, 2009
    Messages:
    982
    Resources:
    1
    Spells:
    1
    Resources:
    1
    I read your mind.
     
  17. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,193
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Aw the system is going so well.
    Do you have any other questions?
     
  18. Catch_ya

    Catch_ya

    Joined:
    May 21, 2009
    Messages:
    982
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Not at the moment, I inform you if I wonder about anything.
     
  19. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,193
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Okay great.
     
  20. Sephalo

    Sephalo

    Joined:
    Oct 12, 2007
    Messages:
    1,791
    Resources:
    0
    Resources:
    0
    Let me see. 3 things. Don't know if I 100% get what you're trying to make in this system but you might find this useful.

    1) Give players the opportunity to make units have multiple attacks they can switch between. Typical example: Unit has a sword. Uses a custom spell that has that command in the trigger for the spell and his attack chances to ranged with arrow missiles. Might be useful if players would have this opportunity.

    2) Give players the opportunity to chose if the ranged attacks from targets collapse upon contact with targets or only collapse if they hit the target the missile was fired for. 3 units stand in a line and you shoot the 3rd one. Does it hit the 1st one or does it ignore the 1st and 2nd one and only hit the 3rd one? Or does it hit them all?!:O

    3) Maybe give players the opportunity to make ranged hits 'following' their target until they hit, or fall on the ground the target was when the shot was fired.

    Maybe this makes it too complicated and tooooo big. But well... You might find this interesting to try to implement as well, because I got the feeling you're doing something incredibly difficult anyway. So why not make it even harder!:grin: