• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Using custom spells for melee maps

Status
Not open for further replies.
Haha, notepad format xD


Seriously though there should be importing instructions somewhere.

There are instructions. It was uploaded in 2008 though, so I'm not sure how the rules were back then lol.

JASS:
/=============================================================================
//           Mamaragan
//           By: scorpion182
//
//           Creates a thunder storm showers lightning everywhere in target location, 
//           that deal massive damage.  
//       
//
//  Spell Requires: Mamaragan ability
//                  Mamaragan dummy unit
//                  
//                  
//  Implementation:
//                  Simply copy the forementioned requirements to your map, go through the 
//                  options below and enjoy! 
//=============================================================================
 
Level 3
Joined
Aug 22, 2015
Messages
42
I want to add the mamaragan ability so I copy pasted the unit mamaragan dummy and the dummy caster then the mamaragan ability then the folder spells in the triggers and it wasn't working, what needs to be edited? I guess the rawcode? I don't know what that is but I know press ctrl D to find it but then I can't change it.
 
Last edited:
Level 3
Joined
Aug 22, 2015
Messages
42
Thanks, it's working now but by the way it wasn't the A00X it was the ABCD that had to be changed.

Right now I'm trying to reduce it's damage because it is too powerful.

constant function Mamaragan_Damage takes integer lvl returns integer
return 150 + ( 140 * lvl) // damage option

Not sure what to change here. The damage is like 500+ I would like to have it around 200+

JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
//=============================================================================
//           Mamaragan
//           By: scorpion182
//
//           Creates a thunder storm showers lightning everywhere in target location, 
//           that deal massive damage.  
//       
//
//  Spell Requires: Mamaragan ability
//                  Mamaragan dummy unit
//                  
//                  
//  Implementation:
//                  Simply copy the forementioned requirements to your map, go through the 
//                  options below and enjoy! 
//=============================================================================

//Configuration Options:
//=============================================================================
constant function Mamaragan_Dummy takes nothing returns integer
    return 'u00G' // rawcode of Mamaragan Dummy unit
endfunction

constant function Mamaragan_AbilId takes nothing returns integer
    return 'A03A' // ability rawcode of Mamaragan ability
endfunction

constant function Mamaragan_Damage takes integer lvl returns integer
    return 150 + ( 140 * lvl) // damage option
endfunction
//Configuration end
//=============================================================================

//=============================================================================
//The Spell itself
//Don't Touch unless you know what you are doing!!
//=============================================================================
function M_DamageFilter takes nothing returns boolean
	if(IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE))then//not effect on building
		return false
	endif
	if(GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) <= 0)then//not effect on died unit
		return false
	endif
	if(IsUnitAlly(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())))then//only damage enemies
		return false
	endif
	return true
endfunction

function M_DoDamage takes nothing returns nothing
	local integer dmg=Mamaragan_Damage(GetUnitAbilityLevel(GetTriggerUnit(),Mamaragan_AbilId()))
    
    call UnitDamageTarget(GetTriggerUnit(), GetEnumUnit(), I2R(dmg), true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
endfunction

function Trig_Mamaragan_Conditions takes nothing returns boolean
    return( GetSpellAbilityId() == Mamaragan_AbilId() )
endfunction

function Trig_Mamaragan_Actions takes nothing returns nothing
    local location loc=GetSpellTargetLoc()
    local unit caster=GetTriggerUnit()
    local location loc2
    local integer i=0
    local unit dummy
    local group grp
    local real x = GetLocationX(loc)
    local real y = GetLocationY(loc)
    local rect r=Rect( x - 400.0*0.5, y - 400.*0.5, x + 400.*0.5, y + 400*0.5 )
    local boolexpr b=Condition(function M_DamageFilter)
    
    loop
    exitwhen i>5
        set loc2=Location(GetRandomReal(GetRectMinX(r), GetRectMaxX(r)), GetRandomReal(GetRectMinY(r), GetRectMaxY(r)))
        set dummy=CreateUnitAtLoc(GetOwningPlayer(caster),Mamaragan_Dummy(),loc2,bj_UNIT_FACING)
        call UnitApplyTimedLife(dummy,'BTLF',0.5)
        call SetUnitPathing(dummy,false)
        call SetUnitInvulnerable(dummy,true)
        call RemoveLocation(loc2)
        set loc2=null
        set i=i+1
    endloop
    
    set grp=CreateGroup()
    call GroupEnumUnitsInRangeOfLoc(grp,loc,400., b)
    call ForGroup(grp,function M_DoDamage)
    
    call DestroyGroup(grp)
    call DestroyBoolExpr(b)
    call RemoveLocation(loc)
    call RemoveRect(r)
    
    set b=null
    set caster=null
    set loc=null
    set grp=null
    set dummy=null
    set r=null
endfunction

//===========================================================================
function InitTrig_Mamaragan takes nothing returns nothing
    set gg_trg_Mamaragan = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Mamaragan, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_Mamaragan, Condition( function Trig_Mamaragan_Conditions ) )
    call TriggerAddAction( gg_trg_Mamaragan, function Trig_Mamaragan_Actions )
endfunction

The datas with the 400 is the area of effect I guess. Because when I changed them to 100 the cast was a small area.

JASS:
local rect r=Rect( x - 400.0*0.5, y - 400.*0.5, x + 400.*0.5, y + 400*0.5 )
call GroupEnumUnitsInRangeOfLoc(grp,loc,400., b)
 
Status
Not open for further replies.
Top