Spell Help Request

Justice

New Member
Reaction score
5
JASS:
//Jade Shield by Hanky aka OrkOfMordor aka MDZ-OrkOfMordor

scope JadeShield initializer init
   //===================================================================================================================
   //Constants
  globals
    private constant integer SpellId  ='A0D5'  //Ability Rawcode: Jade Shield
    private constant integer DummyId  ='e00S'  //Unit Rawcode: Dummy
    private constant real speed       =10.     //Speed of rotating missiles
    private constant real distance    =120.    //Distance of rotating missiles to caster
    private constant real range       =90.     //Collision Range of missiles
    private constant integer amount   =3       //Amount of missiles which rotate around the caster
    private constant boolean knockback=true    //Enable/Disable small knockback when they collide with the missiles
    private constant real knockbackran=20.     //Knockback distance when unit collide with missile
    private constant string MissileMdl="Abilities\\Weapons\\GreenDragonMissile\\GreenDragonMissile.mdl"  //Model of the missiles
    private constant string MissileAtt="chest"  //Attach point of the MissileMdl
    private constant string HitMdl    ="Abilities\\Spells\\Undead\\Possession\\PossessionMissile.mdl"  //Model when missiles hit a unit
    private constant string HitAtt    ="chest"  //Attach point of the HitMdl
    private constant real periodic    =0.03     //The periodic motion time
    
    //Don't change this. This is the key in that your datas will be attached.
     private integer array BuffData[maxIndex]   //Important attached datas
  endglobals
  
  private constant function Damage takes integer lvl returns real
    //Damage the victims get when they collide with the missiles
    return 50.*lvl+50.
  endfunction
  
  private constant function MaxTime takes integer lvl returns real
    //Maximal life time of the missiles
    return 10.
  endfunction
  
  private function UnitFilter takes unit c,unit u returns boolean
    //The unit filter for the units who get damage 
    if IsUnitEnemy(u,GetOwningPlayer(c)) then
    if GetUnitState(u,UNIT_STATE_LIFE)>0. then
    if IsUnitType(u,UNIT_TYPE_FLYING)==false then
    if GetUnitAbilityLevel(u,invulnerable_id)<=0 then
    if IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE)==false then
    return IsUnitType(u,UNIT_TYPE_STRUCTURE)==false
    endif
    endif
    endif
    endif
    endif
    
    return false
  endfunction
  //End Constants
  //===================================================================================================================
  
  //Conditions
  private function Jade_Shield_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SpellId
  endfunction
  
  //Actions
  private struct JadeShieldDatas
    unit caster=null
    unit array missile[amount]
    effect array gfx[amount]
    real angle
    real angledistance
    real time
    integer lvl
  
    method motion takes nothing returns nothing
      local real ux    =GetUnitX(.caster)
      local real uy    =GetUnitY(.caster)
      local real x
      local real y
      local real dmg   =Damage(.lvl)
      local group g
      local unit a
      local real angle =.angle
      local real direc
      local real ax
      local real ay
      local integer i  =1
      local integer f  =0
      
      loop
        exitwhen i>amount
        
        if .gfx[i-1]!=null then 
          set x=ux+distance*Cos(angle*deg2rad)
          set y=uy+distance*Sin(angle*deg2rad)
          call SetUnitPosition(.missile[i-1],x,y)
          call SetUnitFacing(.missile[i-1],angle+90.)
          set g=GetUnitsInRange(range,x,y)
          call GroupRemoveUnit(g,.missile[i-1])
          loop
            set a=FirstOfGroup(g)
            exitwhen a==null or .gfx[i-1]==null
            call GroupRemoveUnit(g,a)
          
            if UnitFilter(.caster,a) then
              if knockback then
                set ax   =GetUnitX(a)
                set ay   =GetUnitY(a)
                set direc=Atan2(ay-uy,ax-ux)
            
                call SetUnitPosition(a,GetUnitX(a)+knockbackran*Cos(direc),GetUnitY(a)+knockbackran*Sin(direc))
              endif
          
              call DestroyEffect(AddSpecialEffectTarget(HitMdl,a,HitAtt))
              call UnitDamageTarget(.caster,a,dmg,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
            
              call DestroyEffect(.gfx[i-1])
              call U2Null(.missile[i-1],0.5)
              set .gfx[i-1]=null
            endif
          endloop
          set g=null
        else 
          set f=f+1
        endif
        
        set angle=angle+.angledistance                
        set i=i+1
      endloop
      
      set .active=.time<=MaxTime(.lvl) and f<amount and GetUnitState(.caster,UNIT_STATE_LIFE)>0. 
      set .time =.time+periodic
      set .angle=.angle+speed
    endmethod
    
    method endmotion takes nothing returns nothing
      local integer i=0
    
      loop
        exitwhen i==amount
      
        if .gfx<i>!=null then
          call DestroyEffect(.gfx<i>)
          call U2Null(.missile<i>,0.5)
          set .gfx<i>    =null
          set .missile<i>=null
        endif
        
        set i=i+1
      endloop
      
      set .caster       =null
      call .destroy()
    endmethod
    
    //! runtextmacro CostumMotion(&quot;JadeShieldDatas&quot;,&quot;motion&quot;,&quot;endmotion&quot;,&quot;periodic&quot;)
  endstruct

  private function Jade_Shield_Actions takes nothing returns nothing
    local unit u             =GetTriggerUnit()
    local real angle
    local real x             =GetUnitX(u)
    local real y             =GetUnitY(u)
    local integer i          =0
    local integer d          =H2I(u)-minIndex
    local JadeShieldDatas dat=BuffData[d]
    
    if dat.active and dat.caster==u then
      set dat.active=false
    endif
    
    set dat              =JadeShieldDatas.create()
    set dat.caster       =u
    set dat.angledistance=360./amount
    set dat.angle        =GetRandomReal(0.,360.)
    set angle            =dat.angle
    set dat.lvl          =GetUnitAbilityLevel(u,SpellId)
    set dat.time         =0.
    loop
      exitwhen i==amount
      
      set dat.missile<i>=CreateUnit(Player(14),DummyId,x+distance*Cos(angle*deg2rad),y+distance*Sin(angle*deg2rad),angle-45)
      set dat.gfx<i>     =AddSpecialEffectTarget(MissileMdl,dat.missile<i>,MissileAtt)
      
      set angle=angle+dat.angledistance
      set i=i+1
    endloop
    
    set BuffData[d]=dat
    call JadeShieldDatas.addMotion(dat)
    set u=null
  endfunction

  //===========================================================================
  private function init takes nothing returns nothing
    local integer i=0  
  
    set gg_trg_Jade_Shield = CreateTrigger(  )
    loop
      call TriggerRegisterPlayerUnitEvent(gg_trg_Jade_Shield, Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT, MainFunctions_filter)

      set i=i+1
      exitwhen i==bj_MAX_PLAYER_SLOTS
    endloop
    call TriggerAddCondition(gg_trg_Jade_Shield, Condition( function Jade_Shield_Conditions ) )
    call TriggerAddAction(gg_trg_Jade_Shield, function Jade_Shield_Actions )
    
    //Preload
    call Preload(MissileMdl)
    call Preload(HitMdl)
  endfunction
endscope</i></i></i></i></i></i></i></i>


When i tried the copy this ability to my map first i copied Ability and Dummy after than i changed raw codes but i tried to save my map and this message appears




What's this and what can i do for the trigger transfer ?
 
Reaction score
341
It means there is no textmacro called CostumMotion created.

Make sure you imported all of the triggers and external systems required.
 

Justice

New Member
Reaction score
5
Ok thanks i found it but i have another problem.
I'm a GUI scripter and i started Jass few days ago and i want to something. I Changed the dummy model to

Abilities\Weapons\GargoyleMissile\GargoyleMissile.mdl

But after the time expires this effect is not removes. How can i remove this code after the time expires ?

Edit: Ok i fixed it with gui trigger but effect is not removes when used (after deals damage)
 

Justice

New Member
Reaction score
5
Ok thanks i found it but i have another problem.
I'm a GUI scripter and i started Jass few days ago and i want to something. I Changed the dummy model to

Abilities\Weapons\GargoyleMissile\GargoyleMissile.mdl

But after the time expires this effect is not removes. How can i remove this code after the time expires ?

Edit: Ok i fixed it with gui trigger but effect is not removes when used (after deals damage) anyone can help me ?
Still i can't solve problem :(
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top