TeaM KingS
[center]Ola Convidado, seja bem vindo ao TeaM KingS !

Nós temos tutoriais sobre o WarCraft World Editor: se você tiver alguma duvida pode perguntar que os moderadores ou membros experientes vão lhe ajudar.

Para melhor utilizar nossos recursos é extremamente recomendado que esteja logado em nosso fórum e que leia o nosso regulamento oficial.

Também temos fóruns sobre DotA AllstarS, com guias, estratégias, e muito mais!




Participe do fórum, é rápido e fácil

TeaM KingS
[center]Ola Convidado, seja bem vindo ao TeaM KingS !

Nós temos tutoriais sobre o WarCraft World Editor: se você tiver alguma duvida pode perguntar que os moderadores ou membros experientes vão lhe ajudar.

Para melhor utilizar nossos recursos é extremamente recomendado que esteja logado em nosso fórum e que leia o nosso regulamento oficial.

Também temos fóruns sobre DotA AllstarS, com guias, estratégias, e muito mais!


TeaM KingS
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

[Spell] Throw Axe v2.0

2 participantes

Ir para baixo

[Spell] Throw Axe v2.0 Empty [Spell] Throw Axe v2.0

Mensagem por Gilgamesh 2013-07-06, 04:58

Descrição da Spell:
O herói encanta seu machado e o arremessa em uma direção, causando danos á todos os inimigos no caminho. Ao término do percurso, o machado explode causando danos adicionais aos inimigos próximos.

Plataforma da Spell:
vJass

Requisitos:
JNGP (Jass New Generation Pack)

Setup (JESP):

Código:
module ThrowAxeSetup

    public static constant method PROJECTILE_RAWCODE takes nothing returns integer
        return 'dumm'
    endmethod
    
    public static constant method DUMMY_RAWCODE takes nothing returns integer
        return 'e000'
    endmethod

    public static constant method SPELL_RAWCODE takes nothing returns integer
        return 'A000'
    endmethod

    public static method SPELL_DAMAGE_FACTOR takes integer level returns integer
        return (level * 100)
    endmethod
    
    public static constant method SPELL_CONSTANT_RANGE takes nothing returns real
        return 1000.00
    endmethod

endmodule
Corpo do Script (Parte 1):

Código:
struct ThrowAxe extends array
    implement ThrowAxeSetup
    implement ThrowAxePart2

    private static hashtable hash = InitHashtable()

    private static method FlyUnit takes unit whichUnit,real whichHeight,real whichRate returns nothing
        call UnitAddAbility(whichUnit,'Amrf')
        call SetUnitFlyHeight(whichUnit,whichHeight,whichRate)
        call UnitRemoveAbility(whichUnit,'Amrf')
    endmethod

    private static method AngleAB takes location whichLocA,location whichLocB returns real
        local real r = 180. / 3.14159 * Atan2(GetLocationY(whichLocB) - GetLocationY(whichLocA),GetLocationX(whichLocB) - GetLocationX(whichLocA))
        return r
    endmethod

    private static method checkSpell takes nothing returns boolean
        local unit u = null
        local player p = null
        local integer i = 0
        local timer t = null
        local group g1 = null
        local group g2 = null
        local group g3 = null
        local unit d = null
        local location l1 = null
        local location l2 = null
        if GetSpellAbilityId()==SPELL_RAWCODE() then
            set u = GetTriggerUnit()
            set p = GetOwningPlayer(u)
            set i = GetUnitAbilityLevel(u,GetSpellAbilityId())
            set t = CreateTimer()
            set g1 = CreateGroup()
            set g2 = CreateGroup()
            set g3 = CreateGroup()
            set l1 = Location(GetUnitX(u),GetUnitY(u))
            set l2 = GetSpellTargetLoc()
            set d = CreateUnit(p,PROJECTILE_RAWCODE(),GetUnitX(u),GetUnitY(u),AngleAB(l1,l2))
            call FlyUnit(d,85.,0.)
            call SaveUnitHandle(hash,GetHandleId(t),StringHash("caster"),u)
            call SaveUnitHandle(hash,GetHandleId(t),StringHash("dummy"),d)
            call SaveInteger(hash,GetHandleId(t),StringHash("lvl"),i)
            call SaveGroupHandle(hash,GetHandleId(t),StringHash("g1"),g1)
            call SaveGroupHandle(hash,GetHandleId(t),StringHash("g2"),g2)
            call SaveGroupHandle(hash,GetHandleId(t),StringHash("g3"),g3)
            call SaveLocationHandle(hash,GetHandleId(t),StringHash("l1"),l1)
            call TimerStart(t,.04,true,function thistype.doLoop)
            set l1 = null
            set l2 = null
            set d = null
            set g3 = null
            set g2 = null
            set g1 = null
            set t = null
            set p = null
            set u = null
        endif
        return false
    endmethod

    private static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            call TriggerRegisterPlayerUnitEvent(t,Player(i),ConvertPlayerUnitEvent(274),null)
            set i = i + 1
            exitwhen i == 12
        endloop
        call TriggerAddCondition(t,Condition(function thistype.checkSpell))
        set t = null
    endmethod

endstruct
Corpo do Script (Parte 2):

Código:
module ThrowAxePart2
    private static player p

    private static method DistanceAB takes location whichLocA,location whichLocB returns real
        local real r1 = GetLocationX(whichLocB) - GetLocationX(whichLocA)
        local real r2 = GetLocationY(whichLocB) - GetLocationY(whichLocA)
        return SquareRoot(r1 * r1 + r2 * r2)
    endmethod

    private static method ProjectionX takes real realX,real whichDist,real whichAngle returns real
        local real x = realX + whichDist * Cos(whichAngle * 3.14159 / 180.)
        return x
    endmethod

    private static method ProjectionY takes real realY,real whichDist,real whichAngle returns real
        local real y = realY + whichDist * Sin(whichAngle * 3.14159 / 180.)
        return y
    endmethod

    private static method killDestruct takes nothing returns nothing
        local destructable u = GetEnumDestructable()
        if GetDestructableLife(GetFilterDestructable())<75 and not IsDestructableInvulnerable(GetFilterDestructable()) then
            call KillDestructable(u)
        endif
        set u = null
    endmethod

    public static method doLoop takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local unit u = LoadUnitHandle(hash,GetHandleId(t),StringHash("caster"))
        local unit d = LoadUnitHandle(hash,GetHandleId(t),StringHash("dummy"))
        local unit f = null
        local player p = GetOwningPlayer(u)
        local integer i = LoadInteger(hash,GetHandleId(t),StringHash("lvl"))
        local group g1 = LoadGroupHandle(hash,GetHandleId(t),StringHash("g1"))
        local group g2 = LoadGroupHandle(hash,GetHandleId(t),StringHash("g2"))
        local group g3 = LoadGroupHandle(hash,GetHandleId(t),StringHash("g3"))
        local location l1 = LoadLocationHandle(hash,GetHandleId(t),StringHash("l1"))
        local location l2 = null
        local real x = ProjectionX(GetUnitX(d),50.,GetUnitFacing(d))
        local real y = ProjectionY(GetUnitY(d),50.,GetUnitFacing(d))
        local effect e = null
        local effect e2 = null
        local destructable f2 = null
        local thistype exe = 0
        call SetUnitPosition(d,x,y)
        set l2 = Location(GetUnitX(d),GetUnitY(d))
        call GroupEnumUnitsInRange(g1,GetUnitX(d),GetUnitY(d),128.,null)
        set thistype.p = p
        call EnumDestructablesInCircleBJ(128,Location(GetUnitX(d),GetUnitY(d)),function thistype.killDestruct)
        loop
            set f = FirstOfGroup(g1)
            if GetUnitState(f,ConvertUnitState(0))>0 and IsUnitEnemy(f,p) and not IsUnitType(f,ConvertUnitType(15)) and not IsUnitInGroup(f,g2) then
                set e2 = AddSpecialEffect("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodKnight.mdl",GetUnitX(f),GetUnitY(f))
                call UnitDamageTarget(d,f,I2R(SPELL_DAMAGE_FACTOR(i)),false,false,ConvertAttackType(0),ConvertDamageType(4),ConvertWeaponType(0))
                call GroupAddUnit(g2,f)
                call DestroyEffect(e2)
                set e2 = null
            endif
            call GroupRemoveUnit(g1,f)
            exitwhen f == null
        endloop
        if DistanceAB(l1,l2) >= SPELL_CONSTANT_RANGE() then
            set e = AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl",GetUnitX(d),GetUnitY(d))
            call GroupEnumUnitsInRange(g1,GetUnitX(d),GetUnitY(d),312.,null)
            loop
                set f = FirstOfGroup(g1)
                if GetUnitState(f,ConvertUnitState(0))>0 and IsUnitEnemy(f,p) then
                    call UnitDamageTarget(d,f,I2R(SPELL_DAMAGE_FACTOR(i)),false,false,ConvertAttackType(0),ConvertDamageType(14),ConvertWeaponType(0))
                    call GroupAddUnit(g2,f)
                endif
                call GroupRemoveUnit(g1,f)
                exitwhen f == null
            endloop
            call FlushChildHashtable(hash,GetHandleId(t))
            call PauseTimer(t)
            call DestroyTimer(t)
            call KillUnit(d)
            call DestroyGroup(g1)
            call DestroyGroup(g2)
            call DestroyGroup(g3)
            call RemoveLocation(l1)
            call RemoveLocation(l2)
            call DestroyEffect(e)
        endif
        set e = null
        set l2 = null
        set l1 = null
        set g3 = null
        set g2 = null
        set g1 = null
        set p = null
        set d = null
        set u = null
        set t = null
    endmethod

endmodule
Download (Demo Map)
 - Open Source: pode ser aberto no World Editor.

JNGP (Link Externo)
 - Página de download da ferramenta
 - Instruções de uso e instalação na página de download (inglês).


Última edição por Gilgamesh em 2013-07-06, 13:25, editado 1 vez(es)
Gilgamesh
Gilgamesh

Número de Posts : 313
Data de inscrição : 11/05/2013
Reputação : 69 Pontos : 23499

Warning Necropost
[Spell] Throw Axe v2.0 Left_bar_bleue0 / 1000 / 100[Spell] Throw Axe v2.0 Right_bar_bleue


http://www.DotCastleBR.forumeiros.com

Ir para o topo Ir para baixo

[Spell] Throw Axe v2.0 Empty Re: [Spell] Throw Axe v2.0

Mensagem por Iky 2013-07-06, 11:22

hello there, oh gil, eu notei uma coisa pq já aconteceu comigo, por isso la vai uma sugestão de uma coisa que precisa ser mudada e outra que é so sugestão mesmo:
  Dê um delay na spell de quando ela ativada para quando seta a direção do machado, por que, caso vc caste a spell numa direção e o champ tiver virado na direção contrária, a direção do machado não será a correta.
  E a segunda ... aplique um sistema de colisão com doods (objetos de cenário, tais como árvore e rockas), apenas uma melhoria, se essa spell cortasse árvores, seria muito útil, ter visão de atrás das árvores (jogadores de beastmaster sabe).
  Mas no geral, a spell ta muito boa, não achei erros tanto no código como na lógica da spell ^^

@EDIT
sleeps dentro de functions não causam problemas ao spell, só lembrando '-' (so aquela parada de caso pause o jogo e talz)
Iky
Iky

Número de Posts : 2065
Data de inscrição : 06/04/2010
Reputação : 99 Pontos : 30404

Warning Necropost
[Spell] Throw Axe v2.0 Left_bar_bleue10 / 10010 / 100[Spell] Throw Axe v2.0 Right_bar_bleue


http://icaro.glauco

Ir para o topo Ir para baixo

[Spell] Throw Axe v2.0 Empty Re: [Spell] Throw Axe v2.0

Mensagem por Gilgamesh 2013-07-06, 12:13

Pois é, não é nem o delay que tá causando esse erro. É porque ao envés de calcular o angulo entre o caster e a área alvo eu só peguei a face atual do caster.

(foi o sono, fiz ela ontém as 4:45)

Já os doodads, vou aceitar sua sugestão. Já já posto update. ")
Gilgamesh
Gilgamesh

Número de Posts : 313
Data de inscrição : 11/05/2013
Reputação : 69 Pontos : 23499

Warning Necropost
[Spell] Throw Axe v2.0 Left_bar_bleue0 / 1000 / 100[Spell] Throw Axe v2.0 Right_bar_bleue


http://www.DotCastleBR.forumeiros.com

Ir para o topo Ir para baixo

[Spell] Throw Axe v2.0 Empty Re: [Spell] Throw Axe v2.0

Mensagem por Iky 2013-07-06, 12:22

entao, adiciona um delay antes do de pegar o facing of unit, é o tempo do hero se posicionar
Iky
Iky

Número de Posts : 2065
Data de inscrição : 06/04/2010
Reputação : 99 Pontos : 30404

Warning Necropost
[Spell] Throw Axe v2.0 Left_bar_bleue10 / 10010 / 100[Spell] Throw Axe v2.0 Right_bar_bleue


http://icaro.glauco

Ir para o topo Ir para baixo

[Spell] Throw Axe v2.0 Empty Re: [Spell] Throw Axe v2.0

Mensagem por Gilgamesh 2013-07-06, 13:27

Updated*

v2.0


  • O Projétil agora corta árvores.
  • Erro na direção do cast corrigido.


Última edição por Gilgamesh em 2013-07-06, 17:29, editado 1 vez(es)
Gilgamesh
Gilgamesh

Número de Posts : 313
Data de inscrição : 11/05/2013
Reputação : 69 Pontos : 23499

Warning Necropost
[Spell] Throw Axe v2.0 Left_bar_bleue0 / 1000 / 100[Spell] Throw Axe v2.0 Right_bar_bleue


http://www.DotCastleBR.forumeiros.com

Ir para o topo Ir para baixo

[Spell] Throw Axe v2.0 Empty Re: [Spell] Throw Axe v2.0

Mensagem por Iky 2013-07-06, 17:26

plz, change logs! quero saber o que vc mudou sem ter que conferir o code todo antes (dica)
Iky
Iky

Número de Posts : 2065
Data de inscrição : 06/04/2010
Reputação : 99 Pontos : 30404

Warning Necropost
[Spell] Throw Axe v2.0 Left_bar_bleue10 / 10010 / 100[Spell] Throw Axe v2.0 Right_bar_bleue


http://icaro.glauco

Ir para o topo Ir para baixo

[Spell] Throw Axe v2.0 Empty Re: [Spell] Throw Axe v2.0

Mensagem por Conteúdo patrocinado


Conteúdo patrocinado


Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos