• 🏆 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!

Skillshot Missiles

Status
Not open for further replies.

sentrywiz

S

sentrywiz

Can anyone show me the simplest way to create a vjass mui skillshot missile? I tried to make one myself but I'm still learning vjass and I failed horribly.
 
That's written in vJass: http://www.hiveworkshop.com/forums/jass-resources-412/system-missile-207854/

If you want simpler code you can search in spell section maybe for GUI/JASS systems and use it as sample for your own code you write in Jass/vJass.

Btw, Triggers & Scripts forum should only be used if you already have written a code with which you have problems to get it work.
 

sentrywiz

S

sentrywiz

That's written in vJass: http://www.hiveworkshop.com/forums/jass-resources-412/system-missile-207854/

If you want simpler code you can search in spell section maybe for GUI/JASS systems and use it as sample for your own code you write in Jass/vJass.

Btw, Triggers & Scripts forum should only be used if you already have written a code with which you have problems to get it work.

Well I had a script, but it was horrible so I decided to just ask for one instead. Still thanks, will check out the link. +rep
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
The full code for one of my abilities. Don't mind what the last function looks like. I have an unusual system for matching abilities with their code.
JASS:
library LightningBolt requires ExtraFunctions,OnDamage,TimedStats
    globals
        private unit array Unit
        private unit array Caster
        private real array Damage
        private real array Ticks
        private real array Vx
        private real array Vy
        private integer Units = 0
        
        private trigger LoopTrig = CreateTrigger()
        
        private integer DUMMY = 'h002'
        private player p
        private group g = CreateGroup()
        private unit u
    endglobals
    
    function UnitFilter takes nothing returns boolean
        if IsUnitAlly(GetFilterUnit(),p) then
            return false
        endif
        if IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) then
            return false
        endif
        return true
    endfunction
    
    private function Loop takes nothing returns nothing
        local integer i = 1
        local real damage
        local real manafactor
        loop
            exitwhen i > Units
            call SetUnitX(Unit[i],GetUnitX(Unit[i])+Vx[i])
            call SetUnitY(Unit[i],GetUnitY(Unit[i])+Vy[i])
            set p = GetOwningPlayer(Unit[i])
            call GroupEnumUnitsInRange(g,GetUnitX(Unit[i]),GetUnitY(Unit[i]),64,Filter(function UnitFilter))
            set u = FirstOfGroup(g)
            set LIFESTEALSFX = true
            if u != null then
                set damage = Damage[i]
                set manafactor = GetManaCostFactor(0.4,GetUnitUserData(Caster[i]))
                if GetUnitState(Caster[i],UNIT_STATE_MANA) < damage*manafactor then
                    set damage = GetUnitState(Caster[i],UNIT_STATE_MANA)/manafactor
                endif
                call DealDamage(Caster[i],u,damage,true,false,false)
                call AddTimedArmor(u,-GetHeroStr(Caster[i],true)*2,50)
                call AddUnitState(Caster[i],UNIT_STATE_MANA,-damage*manafactor)
                call SetUnitX(Unit[i],GetUnitX(u))
                call SetUnitY(Unit[i],GetUnitY(u))
                call KillUnit(Unit[i])
                set Ticks[i] = 0
                call EmptyGroup(g)
                set u = null
            endif
            if Ticks[i] == 0 then
                call KillUnit(Unit[i])
                set Unit[i] = Unit[Units]
                set Caster[i] = Caster[Units]
                set Damage[i] = Damage[Units]
                set Ticks[i] = Ticks[Units]
                set Vx[i] = Vx[Units]
                set Vy[i] = Vy[Units]
                set Units = Units - 1
            else
                set Ticks[i] = Ticks[i] - 1
                set i = i + 1
            endif
        endloop
        if Units == 0 then
            call DisableTrigger(LoopTrig)
        endif
    endfunction

    private function Actions takes nothing returns boolean
        local unit caster = GetTriggerUnit()
        local real x = GetUnitX(caster)
        local real y = GetUnitY(caster)
        local real x2 = GetSpellTargetX()
        local real y2 = GetSpellTargetY()
        local real r = bj_RADTODEG * Atan2(y2 - y, x2 - x)
        set Units = Units + 1
        set Vx[Units] = 29 * Cos(r * bj_DEGTORAD)
        set Vy[Units] = 29 * Sin(r * bj_DEGTORAD)
        set Caster[Units] = caster
        set Ticks[Units] = 32
        set Damage[Units] = I2R(GetHeroInt(caster,true))*4
        set Unit[Units] = CreateUnit(GetOwningPlayer(caster),DUMMY,x,y,r)
        call SetUnitAnimation(Unit[Units],"birth")
        call EnableTrigger(LoopTrig)
        return false
    endfunction

    //===========================================================================
    function InitTrig_Lightning_Bolt takes nothing returns nothing
        local trigger t = CreateTrigger(  )
        call TriggerAddCondition(t, function Actions )
        call TriggerRegisterTimerEvent(LoopTrig,0.03,true)
        call TriggerAddAction(LoopTrig,function Loop)
        set AbilCount = AbilCount + 1
        set AbilQ[AbilCount] = 'A015'
        set AbilW[AbilCount] = 'A01D'
        set AbilE[AbilCount] = 'A01E'
        set AbilR[AbilCount] = 'A01F'
        set AbilZ[AbilCount] = 'A01G'
        set AbilX[AbilCount] = 'A01H'
        set AbilC[AbilCount] = 'A01I'
        set AbilA[AbilCount] = 'A01J'
        set AbilP[AbilCount] = 'A01K'
        set AbilItem[AbilCount] = 'I00P'
        set AbilTrig[AbilCount] = t
    endfunction
endlibrary
 
Read through my posts in this thread. It includes a compact and readable vJass missile system and a mini-tutorial on how structs work. The final system is on the bottom of the first page - one version uses dummy missiles with a unique dummy unit for each missile (OPs request), and the other uses a model path and attaches it to a dummy provided in the post. The second also makes it so that the missiles point in the exact direction they travel (rather than just facing).
 
Status
Not open for further replies.
Top