1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[vJass] (system) Missile

Submitted by Anachron
This bundle is marked as approved. It works and satisfies the submission rules.
I have worked on this missle engine for 2 months now and start the first official beta today.

Please post feedback, critism, pros, cons, bugs, etc.
Thanks all for your patience!

And thanks for downloading.
Preview image by Furby. Thanks a lot!

Edit:
I've updated the testmap and added a second spell.
There is a lot of improvements in version 0.1.7 and I plan to make it even faster and even more modular. I also plan to create an easy to understand API.

Used librarys:

Changelog for 0.1.7

Changed all constants (TRUE, FALSE) to true/false
Changed interval to 0.03125
Fixed object leaks
Performance improvements on MissileMovement: Less object generation
Merged MissileLocHelpers to Missile<type>Target
Removed HomingMissile wrapper
Added second spell (Rain of Fire)
Removed Libraries from Modules


ChangeLog for 0.1.4

Changed name to Missile.
Completely remade in modules, supports now a lot of optional stuff.
Added SpellHelper, fixed a lot of problems, made the Miranas Arrow example WAY more powerful to show what this system is able to be capable of.


Keywords:
Missile, Projectile, xe, xemissile, xecollider, projectile, collider, awesome, anachron, collide, colliding, vJass
Contents

CustomMissile 0.1.7 (Map)

Reviews
Moderator
BPower: 11:02, 25th Feb 2016 Reason for re-review: Nowadays the spell section is packed full of missile systems from different authors, therefore a more qualified moderator comment than "this is neat stuff" is required. There is keen...
  1. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    I think i've found a bug: when you setTargetPosZ() the missile should end at some point above the ground (the z you defined). instead, the missile will always hit the ground, just like setTargetPos. you using the same update functions for both?
     
  2. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Well I'll look at it. I tested it and it seemed to be working probably.
     
  3. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    in my map the projectile goes and change the height, even if the initial height and the end hieght are equal.
     
  4. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Yes, you might want to disable it if you don't like it.
     
  5. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    yeah, i know, but i need somehitng that makes the end height be equal to the initial o_O
     
  6. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Then calculate it?
     
  7. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    you don't get it. IF i set the end.z to 75 using .setTargetLocZ, the arrows ends in the ground like if i imputed 0.00.

    i think the arrow makes "an zarc of 0.00" and finish it's moviment in the ground.

    there's nothing to do with calcules. it's the system. o_O
     
  8. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    That's wrong. Actually the whole system cares about end and start z:

    Code (vJASS):

                if .zArc != 0. then
                    set new.z = ParabolaZ2(.start.z, .end.z, (.start.z + .end.z) /2 + dist * .zArc, dist, toStart)
                endif
     


    Code (vJASS):

            public method setTargetPosZ takes real x, real y, real z returns nothing
                set .end.x = x
                set .end.y = y
                set .end.z = z + .h / 2
     

    So this should not be the fault.

    Maybe you did something wrong with your calculations?

    (Please note that the end-z is absolute)
     
  9. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    test this:
    Code (vJASS):
    scope MagicProjectile initializer init
        private keyword spell
        private struct spellMissile extends CustomMissile
            private spell   spellInst = 0
            private unit source = null
           
            public static method new takes spell ins, unit caster, real spellx, real spelly returns thistype
               local real x = GetUnitX(caster)          
               local real y = GetUnitY(caster)
               local real angle = Atan2(spelly - y, spellx - x)
               local real xloc = x + 1500. * Cos(angle)
               local real yloc = y + 1500. * Sin(angle)
               local thistype this = thistype.create(x, y, GetLocZ(x, y) + 75., angle)
               
               set .source = caster
               set .spellInst = ins
               
                   call .setTargetPosZ(xloc, yloc, 75.)
               return this
            endmethod
           
            method onCreate takes nothing returns nothing
                set .sfx         = "Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl"
                set .movespeed   = 800.
                set .hitrange    = 32.
                set .decay       = 15.
                set .height      = 75.
                set .hitunits    = true
                set .hitdests    = true
                set .autoface    = true
                set .checkheight = false
                set .hitwalls    = true
            endmethod
           
            method onStart takes nothing returns nothing
                call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl", .getEffUnit(), "origin"))
            endmethod
           
            method onLoop takes nothing returns nothing
                set .scale = GetRandomReal(1.,3.)
            endmethod
           
            method onDestTouch takes destructable theDestructable returns nothing
                set .hitunits = false
                set .hitwalls = false
                set .hitdests = false
                set .alive = false
                call BJDebugMsg("Miss!!!")
            endmethod
           
            method onWallHit takes nothing returns nothing
                set .hitunits = false
                set .hitwalls = false
                set .hitdests = false
                set .alive = false
                call BJDebugMsg("Miss!!!")
            endmethod
           
            method onTargetReach takes nothing returns nothing
                set .hitunits = false
                set .hitwalls = false
                set .hitdests = false
                set .alive = false
                call BJDebugMsg("Miss!!!")
            endmethod
           
            method onUnitTouch takes unit theUnit returns nothing
                local real realhigh = GetUnitFlyHeight(.getEffUnit())            
                if GetUnitState(theUnit, UNIT_STATE_LIFE) <= 0 then
                    return
                endif
                if theUnit == .source then
                    return
                endif
                if realhigh < 100 and realhigh > GetUnitFlyHeight(theUnit) then
                    set .hitunits = false
                    set .hitwalls = false
                    set .hitdests = false
                    call BJDebugMsg("Hit!!!")
                    call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl", .getEffUnit(), "origin"))
                    call UnitDamageTarget(.source, theUnit, 100., false, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
                    set .alive = false
                endif
            endmethod
        endstruct
       
        private struct spell
            private spellMissile missile = 0
           
            public static method create takes unit caster, real x, real y returns thistype
                local thistype this = thistype.allocate()
               
                set .missile = spellMissile.new(this, caster, x, y)
               
                return this
            endmethod
        endstruct
       
        private function cast takes nothing returns boolean
            if GetSpellAbilityId() != 'A00B' then
                return false
            endif
            call spell.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
            return false
        endfunction

        private function init takes nothing returns nothing
            local trigger t = CreateTrigger()
            local integer i = 0
           
            call TriggerAddCondition(t, Condition(function cast))
           
            loop
                exitwhen i >= bj_MAX_PLAYERS
               
                call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_CAST, null)
                set i = i +1
            endloop
        endfunction
    endscope
     
     
  10. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    This will hit the ground on height 75, absolute.

    Try this
    Code (vJASS):

    call .setTargetPosZ(xloc, yloc, GetLocZ(xloc, yloc) + 75.)
     


    Edit:
    Btw, I disabled autoface right now.
     
  11. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    will you enable in a near future? or it will end up forgotten just like haze?
     
  12. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    I have never forgotten haze, I just have other things to do. Wc3 isn't top priority, it is coming at the bottom of a long list.

    I'll fix it in the next update, I promise.
     
  13. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    you are right in not making this your priority, this should be a hobbie. =)
     
  14. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Alright, I hope the absolute z-height stuff works for you, wish you a great evening.
     
  15. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Alright, here is the todo for next update.

    [autofacing]
    -allow xyAngle and zAngle autoface.
    - autoface[xy/z] = true/false

    [haze]
    -enable it, get it to work.

    [acceleration]
    -add it
    -timed
    -min / max values

    [offset]
    -add it

    [misc]
    -rework engine, make it even faster
    -overwork some code areas
    -implement a new module system that allows dynamic features

    while not all points may be in the next update, haze and autoface will be in there.
     
  16. lelyanra

    lelyanra

    Joined:
    Sep 4, 2007
    Messages:
    380
    Resources:
    25
    Icons:
    25
    Resources:
    25
    sounds good =} i think after that you might be done with it. =}
     
  17. Berb

    Berb

    Joined:
    Jan 21, 2006
    Messages:
    2,539
    Resources:
    2
    JASS:
    2
    Resources:
    2
    What the hell is a "module system", there is no such thing.
     
  18. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    module system -> Making my features optionally, using modules to add/remove functionality.
     
  19. hell gate

    hell gate

    Joined:
    Nov 23, 2008
    Messages:
    477
    Resources:
    10
    Models:
    1
    Spells:
    9
    Resources:
    10
    may making a collision system ;)
    with a shield module :D
     
  20. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    I already have a collision system in here.
    The shield would not be a module.

    #Update - 0.0.L

    0.0.L

    • Remade a lot of the engine.
    • Very much code fixes.
    • Engine cares about minX/minY/maxX/maxY now.
    • Implemented offset.
    • Faster then ever.
    • Renamed a bunch of stuff.
    • You can decide whether to automatically update xy/z or not.
    • You can now decide for autoFacing of XY (zArc is still in progress)
    • Please check whether haze works.
    • Please check whether every else works correctly.
    • Please forgive me to not update this earlier and to have a lot of stuff renamed.
    • Decay has been overworked. Now decay counts the elapsed time (if its 0.)


    New ToDo

    [autofacing]
    -allow zAngle autofacing.

    [acceleration]
    -add it
    -timed
    -min / max values

    [misc]
    -implement a new module system that allows dynamic features
    -allow enumeration of missiles so you can do timefreeze spells
    -add a timefreeze spell to the demo
     

    Attached Files:

    Last edited: May 2, 2010