- Joined
- Oct 10, 2009
- Messages
- 1,426
it won't let me run the map indication there's a syntax somewhere, but I can't find it, neither can JNPG.
It's got a 90% chance to be in the configuration area.
Any help would be nice >.<
It's not in the rawcodes either. I quadruple checked, just to make sure Pharaoh_ doesn't make me look dumb with those again
It's got a 90% chance to be in the configuration area.
Any help would be nice >.<
JASS:
//===========================================================================
//A vJASS and JESP spell that will have an effetc depending on the number
//of units in the AOE. If there are more allies than enemies, we heal allies
//if there are more enemies that allies we damage enemies, if the number of
//allies equals the number of enemies we heal the allies and damage the enemies
//
//@author Flame_Phoenix
//
//@credits
//- Blade.dk, for the CopyCroup function
//
//@version 1.0
//===========================================================================
scope InstantJustice initializer Init
//===========================================================================
//=============================SETUP START===================================
//===========================================================================
globals
private constant integer SPELL_ID = 'A00X' //the rawcode of the spell
private constant integer DUMMY_ID = 'h002' //rw of the dummy unit
private constant string AOE_EFFECT = "Units\\NightElf\\Wisp\\WispExplode.mdl" //effect that will be created when we cast the spell on the AOE
private constant string HEAL_EFFECT = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" //effect that will be created when we heal units
private constant string DAMAGE_EFFECT = "Abilities\\Weapons\\Bolt\\BoltImpact.mdl" //effect that will be created when we damage units
private constant damagetype D_TYPE = DAMAGE_TYPE_NORMAL //the attack type of the spell
private constant attacktype A_TYPE = ATTACK_TYPE_MAGIC //the damage type of the spell
endglobals
private function Range takes integer level returns real
//returns the range the spell will affect
return level * 300.
endfunction
private function Heal takes integer level returns real
//returns the heal allies will take
return level * 500.
endfunction
private function Damage takes integer level returns real
//returns the damage enemies will take
return level * 500.
endfunction
private function Targets takes unit target returns boolean
//the units the spell will affect
return (GetWidgetLife(target) > 0.405) and (IsUnitType(target, UNIT_TYPE_STRUCTURE) == false) and (IsUnitType(target, UNIT_TYPE_MAGIC_IMMUNE) == false) and (IsUnitType(target, UNIT_TYPE_MECHANICAL) == false)
endfunction
//===========================================================================
//=============================SETUP END=====================================
//===========================================================================
globals
private group all
private group copy
private boolexpr b
endglobals
//===========================================================================
//Function made by Blade.dk; Search for [url]www.wc3campaigns.com[/url] for more info
private function CopyGroup takes group g returns group
set bj_groupAddGroupDest = CreateGroup()
call ForGroup(g, function GroupAddGroupEnum)
return bj_groupAddGroupDest
endfunction
//===========================================================================
private function Pick takes nothing returns boolean
return Targets(GetFilterUnit())
endfunction
//===========================================================================
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == SPELL_ID
endfunction
//===========================================================================
private function Actions takes nothing returns nothing
local location spellLoc = GetSpellTargetLoc()
local real spellX = GetLocationX(spellLoc)
local real spellY = GetLocationY(spellLoc)
local unit caster = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(caster, SPELL_ID)
local unit f
local integer allies = 0
local integer enemies = 0
//create the AOE effect
call DestroyEffect(AddSpecialEffect(AOE_EFFECT, spellX, spellY))
//counting the units
call GroupEnumUnitsInRange(all, spellX, spellY, Range(level), b)
set copy = CopyGroup(all)
loop
set f = FirstOfGroup(copy)
exitwhen(f == null)
call GroupRemoveUnit(copy, f)
if IsUnitAlly(f, GetOwningPlayer(caster)) then
set allies = allies + 1
else
set enemies = enemies + 1
endif
endloop
//making the effect of the spell
if allies > enemies then
loop
set f = FirstOfGroup(all)
exitwhen (f == null)
call GroupRemoveUnit(all, f)
//heal allies
if IsUnitAlly(f, GetOwningPlayer(caster)) then
call DestroyEffect(AddSpecialEffectTarget(HEAL_EFFECT, f, "origin")) //the healing effect
call SetWidgetLife(f, GetWidgetLife(f) + Heal(level))
endif
endloop
elseif enemies > allies then
loop
set f = FirstOfGroup(all)
exitwhen (f == null)
call GroupRemoveUnit(all, f)
//damage enemies
if IsUnitEnemy(f, GetOwningPlayer(caster)) then
call DestroyEffect(AddSpecialEffectTarget(DAMAGE_EFFECT, f, "origin")) //the damaging effect
call UnitDamageTarget(caster, f, Damage(level), true, false, A_TYPE, D_TYPE, null)
endif
endloop
elseif allies == enemies then
loop
set f = FirstOfGroup(all)
exitwhen (f == null)
call GroupRemoveUnit(all, f)
//heal allies
if IsUnitAlly(f, GetOwningPlayer(caster)) then
call DestroyEffect(AddSpecialEffectTarget(HEAL_EFFECT, f, "origin"))
call SetWidgetLife(f, GetWidgetLife(f) + Heal(level))
//if an unit is not an ally than it is an enemy
else
call DestroyEffect(AddSpecialEffectTarget(DAMAGE_EFFECT, f, "origin"))
call UnitDamageTarget(caster, f, Damage(level), true, false, A_TYPE, D_TYPE, null)
endif
endloop
endif
call RemoveLocation(spellLoc)
set spellLoc = null
set caster = null
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger InstantJusticeTrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(InstantJusticeTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(InstantJusticeTrg, Condition( function Conditions ) )
call TriggerAddAction( InstantJusticeTrg, function Actions )
//setting globals
set all = CreateGroup()
set copy = CreateGroup()
set b = Condition(function Pick)
//preloading effects
call Preload(AOE_EFFECT)
call Preload(HEAL_EFFECT)
call Preload(DAMAGE_EFFECT)
//preloading the ability
set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID, 0, 0, 0)
call UnitAddAbility(bj_lastCreatedUnit, SPELL_ID)
call KillUnit(bj_lastCreatedUnit)
endfunction
endscope
It's not in the rawcodes either. I quadruple checked, just to make sure Pharaoh_ doesn't make me look dumb with those again