Spellpack Magic Bolts

waaaks!

Zinctified
Reaction score
255
JASS: yes
MUI: yes
JESP: think so?
LEAKFREE: think so? cause it has less lag
SYSTEM: caster system

Import difficulty low

Magic Bolt
Throws a magical bolt to an enemy unit, that deals damage and stunning it, when the bolt arrives, it creates another magic bolts to enemy units nearby, also dealing damage and stunning it
magicboltss2.jpg


JASS:
//****************************************************************************************************
//*-----------------------------------Spell made by: waaaks!------------------------------------------
//*
//*-----------------------------------Requires the caster system and cscache module-------------------
//*
//****************************************************************************************************
//*
//*  *Requires the Magic Pulse spell
//*  *Requires the Magic Pulse (dummy) spell
//*  
//*  -Copy the spells Magic Pulse and Magic Pulse (dummy) spells into your map
//*  -Change the rawcodes below like 'A000' to the raw code of the spell
//*  -To know the raw codes go to object editor and press CTRL+D
//*
//****************************************************************************************************
constant function MagicBoltId takes nothing returns integer
 return 'A000' //Rawcode for Hero's Spell
endfunction

constant function MagicBoltDummyId takes nothing returns integer
 return 'A001' //Rawcode for Dummy's Spell
endfunction

constant function MagicBoltSpeed takes nothing returns real
 return 1000.0 //Change this to your Spell's Missile speed
endfunction

constant function MagicBoltOrderId takes nothing returns string
 return "thunderbolt" //Order Id of your spell
endfunction

constant function MagicBoltRad takes nothing returns real
 return 600.0 //Radius on the units affected with the bolt
endfunction

function MagicBolt_Actions takes nothing returns nothing
 local unit cast = GetTriggerUnit()
 local unit targ = GetSpellTargetUnit()
 local location loc1 = GetUnitLoc(cast)
 local location loc2 = GetUnitLoc(targ)
 local integer l
 local real wait
 set l = GetUnitAbilityLevel( cast, MagicBoltId() )
 set wait = DistanceBetweenPoints( loc1, loc2)/MagicBoltSpeed()
 call PolledWait(wait)
 call CasterSetRecycleDelay(3.0)
 call CasterSetCastSourceLoc( loc2 )
 call CasterCastAbilityLevelAOELoc( GetOwningPlayer(cast), MagicBoltDummyId(), l, MagicBoltOrderId(), loc2, MagicBoltRad(), false, false ) 
 call RemoveLocation(loc1)
 call RemoveLocation(loc2)
 set loc1 = null
 set loc2 = null
 set cast = null
 set targ = null
endfunction

//===========================================================================
function InitTrig_MagicBolt takes nothing returns nothing
    call OnAbilityEffect(MagicBoltId(), "MagicBolt_Actions")
endfunction


Water Shock
Creates a lightning to the targeted deep water, any units inside the radius shall take damage.
item


JASS:
//****************************************************************************************************
//*--------------------------------------Spell made by: waaaks!---------------------------------------
//*-----------------------------Requires the caster system and cscache module-------------------------
//*--------------------------------------Requires the Sim Error---------------------------------------
//*
//****************************************************************************************************
//*
//* *Copy all the functions in the header to your map's header
//* *Requires the Water Shock spell
//*
//*  -Copy the spell Water Shock spell into your map
//*  -Change the rawcodes below like 'A005' to the raw code of the spell
//*  -To know the raw codes go to object editor and press CTRL+D
//*
//****************************************************************************************************


constant function ShockId takes nothing returns integer
 return 'A005' //Rawcode for the Water Shock Spell
endfunction

constant function ShockDamage takes nothing returns real
 return 50.0 //Damage dealt x level
endfunction

constant function ShockRad takes nothing returns real
 return 500.0 //AOE radius of the spell
endfunction

constant function ShockSfx takes nothing returns string
 return "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl"
   //Special effect you want to use for the lightning bolt
endfunction

constant function ShockMsg takes nothing returns string
 return "Must target deep water" //The message when the spell is not target on deep water
endfunction

function Shock_Actions takes nothing returns nothing
 local unit cast = GetTriggerUnit()
 local location loc = GetSpellTargetLoc()
 local integer dopt
 local integer l
  if IsPointWaterLoc(loc) then
   set dopt = DamageTypes(ATTACK_TYPE_SIEGE,DAMAGE_TYPE_FORCE)
   set dopt = dopt + DamageOnlyTo(UNIT_TYPE_GROUND)
   set l = GetUnitAbilityLevel(cast, ShockId())
   call DestroyEffect( AddSpecialEffectLoc( ShockSfx(), loc) )
   call DamageUnitsInAOEExLoc(cast, l*ShockDamage(), loc, ShockRad(), false, dopt)  
  else
   call SimError(GetOwningPlayer(cast), ShockMsg())
  endif
 call RemoveLocation(loc)
 set loc = null
 set cast = null
endfunction

//===========================================================================
function InitTrig_Shock takes nothing returns nothing
    call OnAbilityEffect(ShockId(), "Shock_Actions")
endfunction


Magic Missile
Creates a magic missile to the target location, any unit that collides with the missile shall receive damage and stunned
item


JASS:
//****************************************************************************************************
//*---------------------------------------Spell made by: waaaks!--------------------------------------
//*---------------------------Requires the caster system and cscache module---------------------------
//*
//****************************************************************************************************
//*
//* *Requires the Magic missile spell
//* *Requires the Magic missile (dummy) spell
//*
//*  -Copy the spells Magic Missile and Magic Missile (dummy) spells into your map
//*  -Change the rawcodes below like 'A003' to the raw code of the spell
//*  -To know the raw codes go to object editor and press CTRL+D
//*
//****************************************************************************************************
scope Missile

globals
    private constant integer SPELL_ID  = 'A003' //Rawcode for spell
    private constant integer DUMMY_ID  = 'A004' //Rawcode for dummy spell
    private constant string  ORDER_ID  = "thunderbolt" //order id of the dummy spell
    private constant string  SFX       = "Abilities\\Spells\\Other\\FrostBolt\\FrostBoltMissile.mdl" //missile effect
    private constant real    COLLISION = 400.0 //collision size of the missile
    private constant real    SPEED     = 1000.0 //missile speed
    private constant real    RANGE     = 1000.0 //missile max range
    private constant real    Z_OFFSET  = 50.0 //missile's flying height
    private constant real    SCALE     = 5.0 //missile's scaling
endglobals

private struct missiledata
    unit castingunit
endstruct


private function Impact takes nothing returns nothing
 local unit targ = GetTriggerUnit()
 local unit m = GetTriggerCollisionMissile()
 local missiledata D= missiledata( CollisionMissile_GetTag(GetTriggerCollisionMissile()) )
 local location loc
 local location loc2
 local location loc3
 local integer l
 local integer dopt

    if(targ==null) then
        call D.destroy()
        return
    endif
    set loc  = GetUnitLoc(D.castingunit)
    set loc2 = GetUnitLoc(targ)
    set loc3 = GetUnitLoc(m)
    call SetUnitScale(m, SCALE, SCALE, SCALE)
    call CasterSetCastSourceLoc(loc3)
    call CasterSetRecycleDelay(3.00) 
    set l = GetUnitAbilityLevel( D.castingunit, SPELL_ID )
    if IsUnitEnemy(targ, GetOwningPlayer(D.castingunit)) and IsUnitAliveBJ(targ) then
       call CasterCastAbilityLevel(GetOwningPlayer(D.castingunit), DUMMY_ID, l, ORDER_ID, targ, false ) 
    endif
    call RemoveLocation(loc)
    call RemoveLocation(loc2)

 set loc = null
 set loc2 = null
 set targ = null  
endfunction

private function Start takes nothing returns nothing
 local unit cast = GetTriggerUnit()
 local missiledata D = missiledata.create()
 local location loc1 = GetUnitLoc(cast)
 local location loc2 = GetSpellTargetLoc()
 local real face = AngleBetweenPoints(loc1, loc2)
 local unit m

     set D.castingunit = cast
     set m=CollisionMissile_CreateLoc( SFX, loc1, face, SPEED, 0, RANGE, Z_OFFSET, false, COLLISION, function Impact )
     call CollisionMissile_SetTag(m , integer(D) )

 call RemoveLocation(loc1)
 call RemoveLocation(loc2)
 set loc1 = null
 set loc2 = null
 set cast = null 
 set m=null
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
 call OnAbilityEffect( SPELL_ID, SCOPE_PRIVATE+"Start" )
endfunction

endscope


Ethereal Dagger
Shoots an ethereal dagger to the target location, any enemy units that collides with the missile shall receive some damage, while friendly units that collide with the missile shall be healed.
item


JASS:
//****************************************************************************************************
//*---------------------------------------Spell made by: waaaks!--------------------------------------
//*-------------------------Requires the caster system and cscache module-----------------------------
//*
//****************************************************************************************************
//*
//* *Requires the Ethereal Dagger Spell
//*
//*  -Copy the spell Ethereal Dagger spell into your map
//*  -Change the rawcodes below like 'A006' to the raw code of the spell
//*  -To know the raw codes go to object editor and press CTRL+D
//*
//****************************************************************************************************

scope EtherealDagger

globals
    private constant integer EDSPELL_ID   = 'A006' //Rawcode for ethereal dagger
    private constant real    EDRANGE      = 1000.0 //max range of spell
    private constant real    EDCOLLISION  = 300.0  //collision size of the spell
    private constant real    EDSPEED      = 1000.0 //missile's speed
    private constant real    EDZ_OFFSET   = 50.0   //flying height of missile
    private constant real    EDSCALE      = 6.0    //scaling of missile
    private constant real    EDDMG        = 50.0   //heal or damage per level
    private constant string  EDSFX        = "Abilities\\Weapons\\BloodElfMissile\\BloodElfMissile.mdl" //missile model
    private constant string  EDSFX1       = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"  //enemy sfx when hit
    private constant string  EDSFX2       = "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" //ally sfx when hit
endglobals

private struct data
    unit caster
endstruct

private function EDImpact takes nothing returns nothing
 local unit targ = GetTriggerUnit()
 local unit m = GetTriggerCollisionMissile()
 local data E= data(CollisionMissile_GetTag(GetTriggerCollisionMissile()))
 local location loc
 local location loc2
 local integer l
  if (targ==null) then
   call E.destroy()
   return
  endif
  set loc = GetUnitLoc(E.caster)
  set loc2 = GetUnitLoc(targ)
  call SetUnitScale(m, EDSCALE, EDSCALE, EDSCALE)
  set l = GetUnitAbilityLevel(E.caster, EDSPELL_ID)
  if IsUnitEnemy(targ, GetOwningPlayer(E.caster)) == true and IsUnitAliveBJ(targ) == true then
   call UnitDamageTargetBJ(E.caster, targ, l*EDDMG, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
   call DestroyEffect(AddSpecialEffectLoc(EDSFX1, loc2))
  else
   if IsUnitEnemy(targ, GetOwningPlayer(E.caster)) == false and IsUnitAliveBJ(targ) == true then
    call SetUnitLifeBJ( targ, ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + ( l * EDDMG ) ) )
    call DestroyEffect(AddSpecialEffectLoc(EDSFX2, loc2))
   endif
  endif
  call RemoveLocation(loc)
  call RemoveLocation(loc2)
  set loc = null
  set loc2 = null
  set targ = null
endfunction

private function EDStart takes nothing returns nothing
 local unit cast = GetTriggerUnit()
 local data E= data.create()
 local location loc1 = GetUnitLoc(cast)
 local location loc2 = GetSpellTargetLoc()
 local real face = AngleBetweenPoints(loc1, loc2)
 local unit m
 set E.caster = cast
 set m = CollisionMissile_CreateLoc(EDSFX, loc1, face, EDSPEED, 0.0, EDRANGE, EDZ_OFFSET, false, EDCOLLISION, function EDImpact)
 call CollisionMissile_SetTag(m, integer(E))
 call RemoveLocation(loc1)
 call RemoveLocation(loc2)
 set loc1 = null
 set loc2 = null
 set cast = null
 set m = null  
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
    call OnAbilityEffect(EDSPELL_ID, SCOPE_PRIVATE+"EDStart")
endfunction

endscope


images are not so perfect so its best to try it ingame

thx to vexorian for helping me out
 

Attachments

  • [Spellpack] Magic Bolts.w3x
    283.7 KB · Views: 491

waaaks!

Zinctified
Reaction score
255
so that means, only locals could make it JESP?

any bugs found. or any glitches?

feedbacks?
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Chance to learn how people uses struct >.>

Thanks
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>But what are those "global, privates"?
vjass function...scope thingy

@ waaaks!
Was Ethereal Dagger MUI?
 

waaaks!

Zinctified
Reaction score
255
i think not, i even think ethereal dagger and magic missile are not mui cause they use globals...

just my opinion :p
 

0zaru

Learning vJASS ;)
Reaction score
60
They are MUI. A spell is not defined for not-being MUI just because it uses globals
 

waaaks!

Zinctified
Reaction score
255
ok....so...how about JESP? are they JESP?
purge say magic missile and ethereal dagger are not because they use globals
 

Sim

Forum Administrator
Staff member
Reaction score
534
Great spells :D

Magic Bolt

Simple yet fun to use.

Shock

Very original :)

Magic Missile

Nice. I went on a rampage spamming this thing :D

Ethereal Dagger

Doesn't look like a dagger, but nice spell anyhow.

Approved ;)
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
The last spell can be accomplished by using 2 shockwaves and minimal trigger:
  • Shockwave 1 deals damage to enemies and has missile art
  • Shockwave 2 deals negative damage to allies and has no missile art
  • Both spells have the same missile speed
  • Upon the player casting Shockwave 1, create a dummy unit at the position of the caster and order it to use Shockwave 2 on the targeted point/position of unit
  • Clean up leaks
...

And the rest of these are... well not very much triggering. :(

There are also a few BJ calls:
JASS:
call UnitDamageTargetBJ(E.caster, targ, l*EDDMG, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
//...
if IsUnitEnemy(targ, GetOwningPlayer(E.caster)) == false and IsUnitAliveBJ(targ) == true then //There is also no need to compare either of these to true/false
//...
call SetUnitLifeBJ( targ, ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + ( l * EDDMG ) ) )

This is inefficient and could just be replaced with an elseif:
JASS:
  else
   if IsUnitEnemy(targ, GetOwningPlayer(E.caster)) == false and IsUnitAliveBJ(targ) == true then
    call SetUnitLifeBJ( targ, ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + ( l * EDDMG ) ) )
    call DestroyEffect(AddSpecialEffectLoc(EDSFX2, loc2))
   endif
  endif

And for god's sake why are you using locations?!

To be perfectly honest, I wouldn't approve these spells until they're fixed to be efficient and properly coded.
 

Sim

Forum Administrator
Staff member
Reaction score
534
> The last spell can be accomplished by using 2 shockwaves and minimal trigger:

If the results are the same, then why bother? Sure it could've been "simpler", but who said triggering was to be forbidden?

As long as it's functional, nice and that it can be easily implemented, a spell or spellpack will make it to the section. They do not need to be perfect.

Having the most efficient spell is optional, as long as it's leakless, lagless, and works quite good.

> I wouldn't approve these spells until they're fixed to be efficient and properly coded.

Whether or not you would approve these spells is not the point. I feel these spells are worth it and so they're in this section right now.
 

NapaHero

Back from the dead...
Reaction score
43
hmm...Magic Bolt and Magic Missile are a bit identical: both of them launch small bolts that deals damage and stun.
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Daxtreme said:
Whether or not you would approve these spells is not the point. I feel these spells are worth it and so they're in this section right now.
For christ's sake... he asked for opinions. That's mine.
 

waaaks!

Zinctified
Reaction score
255
anyways thanks pyro for saying that bj functions are useless....next time ill avoid them..
 
F

forSophia

Guest
hello. i haven't learned JASS language yet, though i know some c++.

was just wondering how to code a simple magic missile that is destroyed on colliding with the first target using just GUI triggers. it would be like mirana's elune's arrow skill in dota.

thanks for your attention.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top