• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Missile system

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
What missile system would be considered the "best"? (Or most favorable in your opinion). I've been using xe but nes said its bad and its starting to lag my map considerably (with 4 projectiles lol) and ive been digging around a bit and cant really find anything special.

(vJass only, of course.)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
The one I used to use was Berb's Projectile

So far, that's the only one I'm accustomed to, aside from my own (which is very lame and was my very first vJASS resource)

Though right now, there might be other better systems out there as that one uses interfaces and some other things...

Hm..

It has some nice-looking features but it uses interfaces and extensions which is just code duplication.

I'm currently experimenting with Dirac's missile, though I dont like the way it uses the target x/y/z rather than angle...

E/ Dirac's was an epic fail, the demo just spams missiles like crazy and the constructor's API information is wrong

2E/ trying anachron's

3E/ k.. no
 
Last edited:
Level 19
Joined
Aug 8, 2007
Messages
2,765
Dirac's forever.

Berb's Missile has no instant facing, same goes to xe. Dirac's has an instant facing.

I can't get anything to work, the demo doesnt even do anything and when I try to cast a missile it just puts a missile where im standing and doesnt do anything...

Also, isn't graduated facing better than instant facing? for realism...
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I'm using Kenny's system. It might be kinda old, but still works, and the features. Oh, the features man.

link?

E/ ok i got Dirac's system to work but the missiles have collision o_O they can go over stuff but if i try to cast twice in a row, the missile will kick the caster out of its spot. (missile has crow form, collision is 0)

2e/ Also, the missiles im using have ribbons and the missile recycler seems to be dragging them across the map o_O

3e/ Ok its still ribboning but i really dont care atm. I fixed the wierd collision thing by just setting their pathing type to fly. I dont know why but after about three minutes of using this spell to farm the system totally breaks and when I cast spells, the projectiles don't move or collide

JASS:
library ShootLightningInFrontOfCaster initializer spellOnInit requires Missile
    globals
        integer ABILITY = 'A04A'
    endglobals
    struct MissileHandler
        static method onCollide takes Missile this, unit justHit returns boolean
            local boolean b
            if justHit != null then and this.source != justHit and not IsUnitAlly(justHit, GetOwningPlayer(this.source)) then
                    if GetUnitAbilityLevel(justHit, 'A00H') > 0 then
                        set b = GetWidgetLife(justHit) >= 2000000.402 
                    else
                        set b = GetWidgetLife(justHit) >= 0.402
                    endif
                    if b then
                        call UnitDamageTarget(this.source, justHit, GetHeroAgi(this.source, true) * (3 + (0.2 * GetUnitAbilityLevel(this.source,ABILITY))),true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
                        return true
                    endif
                endif
            endif
            return false
        endmethod
        implement MissileStruct
    endstruct
    private function add takes Missile m, unit caster returns nothing
        set m.model = "war3mapImported\\Lightning Bolt.mdl"
        set m.speed = 30
        set m.collision = 100
        set m.source = caster
        call MissileHandler.launch(m)
    endfunction
    private function onCast takes nothing returns boolean
        local unit caster 
        local AdvLoc orig 
        local AdvLoc dest 
        local Missile m
        local integer numBolts 
        local real angleDifferentialBetweenBolts 
        local integer i = 0
        local real currentBolt
        if GetSpellAbilityId() != 'A04A' then
            return false
        endif
        set caster = GetTriggerUnit()
        set orig = AdvLoc.create(GetUnitX(caster),GetUnitY(caster),50)
        set dest = AdvLoc.create(GetSpellTargetX(),GetSpellTargetY(),50) 
        set numBolts = 2+GetUnitAbilityLevel(caster, 'A04A')
        set angleDifferentialBetweenBolts = bj_DEGTORAD*5
        call AdvLoc.link(orig,dest)
        if ModuloInteger(R2I(numBolts),2) == 0 then
            set currentBolt = orig.angle + (angleDifferentialBetweenBolts/2)
            if numBolts > 2 then
                set currentBolt = currentBolt + (angleDifferentialBetweenBolts*((numBolts/2)-1))
            endif
        else
            set currentBolt = orig.angle
            if numBolts > 2 then
                set currentBolt = currentBolt + (angleDifferentialBetweenBolts*((numBolts-1)/2))
            endif
        endif
        loop
            exitwhen i == numBolts
            set m = Missile.create(orig.x, orig.y, 50, currentBolt, 900, 50)
            set currentBolt = currentBolt - angleDifferentialBetweenBolts
            call add(m,caster)
            set i = i + 1
        endloop
        set caster = null
        call orig.unlock()
        call dest.unlock()
        return false
    endfunction
    private function spellOnInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Filter(function onCast))
    endfunction
endlibrary
 
Last edited:
I use Kenny's system as well. It is very very fun to play with (see his optional module with bouncing). The only problem is that the dependencies may be considered a bit dated (AIDS--I don't consider it "dated" but if you already have an indexing system then you'll have to port it), but it still works wonderfully. With some effort, it should be relatively easy to port to another indexing system anyway.
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
The other "big" indexer around is UnitIndexer, and it has an AIDS wrapper, so it really shouldn't be a problem :) And yea, as you said, it's capable of sooo many things. I did some modifications to it, so that it'd allow me to fire units I pass as projectiles, it's really cool :'D It's a shame that the new modules Kenny was talking about in the thread did not come out. Still, Shadow and Bounces are pretty cool.

What I dislike is the linked list module, as there are far more efficient ways to code it, and maybe instead of T32, it could use a static timer of its own (with 20 projectiles it's 640 function calls, basically for no reason), but all the functionality it provides makes it well worth it.

I'm not using the recycling feature, though, because of the lack of instant facing. Is it a big problem?
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I like it, but it has an extremely low max missile count (i got it to 3fps at 100 missiles)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Anyone?

Also, kenny's impact system glitches, land and dest impact don't work if theres a unit impact (test it with Gravity Ball, it will go over cliffs and wont destroy trees if theres a unit being dragged)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
MISSILE_EVENT_ON_DROP // detects when a missile drops/hits to the ground
MISSILE_EVENT_PERIODIC // detects the periodic movement of a missile

Actually, both Kenny's and Anachron's system has similar ones - Kenny's surely has those, not sure about Anachron's. They're mainly the reason why I sticked to Kenny's system (and ProjGroups).

Correct, kenny's, anarchon's, i believe Dirac's does too, XE i know has periodic not sure about on_drop but that can just be done by getting location of terrain and height of missile.

Kenny's also has for colliding with units, destructables, and other projectiles. :\
 
Status
Not open for further replies.
Top