World of Warcraft

View All Posts by This User Toggle Ignore / Unignore This User
  • Level: 5 Random Team
  • Gateway: Northrend
  • 0. Merging Summoned Units   04/26/2011 08:56:09 AM PDT
Hello, I use an custom variant of pickup archer to merge two units into one. But it doesnt work with summoned units. How can I convert a summoned unit into a ''normal'' unit so I can merge them?
I tried darkconversion but it makes the target lose its abilities.

[ Post edited by Dark_warchief ]

View All Posts by This User Toggle Ignore / Unignore This User
  • Level: 1
  • Gateway: Northrend
  • 1. Re: Merging Summoned Units   05/27/2011 02:19:45 AM PDT
I had this exact same problem, the solution I ended up using is fairly complicated.

Since the archer ability didn't work (in my case, I also had the problem that the two units I was trying to merge were of the same type, which also didn't work, although in hindsight my problem might have also been that they were summoned rather than regular units), I went for a trigger-based workaround. When one summoned unit used a dummy ability to merge with another summoned unit, I first checked if the two units were valid (since the dummy ability could be used to target anything) and if they were, I killed then both and then used a dummy caster to summon the merged unit (instead of just creating the new unit, in which case it wouldn't count as a summoned unit and wouldn't have an expiration timer). I ended up coding the whole thing in vJass, so it might be useless to you:
scope StormElemental initializer Init //requires SpellEvent, xecast


globals
private constant integer ELEMENTAL_LEVEL1 = 'h00A'
private constant integer ELEMENTAL_LEVEL2 = 'h00B'
private constant integer ELEMENTAL_LEVEL3 = 'h00C'

private constant string MERGE_ORDER = "frostarmor"
private constant integer MERGE_ABILITY = 'A024'

private constant integer DUMMY_SPELL = 'A013'
private constant string DUMMY_SPELL_ORDER="waterelemental"

private xecast caster
endglobals

private function SpellEffect takes nothing returns nothing
local integer id = GetUnitTypeId(SpellEvent.CastingUnit)
local real x=0.5*(GetUnitX(SpellEvent.CastingUnit)+GetUnitX(SpellEvent.TargetUnit))
local real y=0.5*(GetUnitY(SpellEvent.CastingUnit)+GetUnitY(SpellEvent.TargetUnit))
if id==ELEMENTAL_LEVEL1 then
set caster.level=1
elseif id==ELEMENTAL_LEVEL2 then
set caster.level=2
elseif id==ELEMENTAL_LEVEL3 then
set caster.level=3
endif
set caster.owningplayer=GetOwningPlayer(SpellEvent.CastingUnit)
call UnitRemoveBuffs(SpellEvent.CastingUnit, true, true)
call UnitRemoveBuffs(SpellEvent.TargetUnit, true, true)
call caster.castInPoint(x,y)
endfunction

private function UnitTypeCheck takes nothing returns boolean
local integer id = GetUnitTypeId(GetOrderedUnit())
return (id==ELEMENTAL_LEVEL1 or id==ELEMENTAL_LEVEL2 or id==ELEMENTAL_LEVEL3)
endfunction

private function Order takes nothing returns nothing
local unit s = GetOrderedUnit()
local integer id = GetUnitTypeId(GetOrderTargetUnit())
if GetIssuedOrderId()==OrderId("smart") then
if (id==ELEMENTAL_LEVEL1 or id==ELEMENTAL_LEVEL2 or id==ELEMENTAL_LEVEL3) then
if not IsUnitPaused(s) then
// call PauseUnit(s, true)
call IssueTargetOrder(s, MERGE_ORDER, GetOrderTargetUnit())
// call PauseUnit(s, false)
endif
call BJDebugMsg("SpellOrder")
endif
elseif GetIssuedOrderId()==OrderId(MERGE_ORDER) then
if not(id==ELEMENTAL_LEVEL1 or id==ELEMENTAL_LEVEL2 or id==ELEMENTAL_LEVEL3) then
if not IsUnitPaused(s) then
call PauseUnit(s, true)
call IssueImmediateOrder(s, "stop")
call PauseUnit(s, false)
endif
call BJDebugMsg("CancelOrder")
endif
endif
set s=null
endfunction

private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerAddCondition(t, Condition(function UnitTypeCheck))
call TriggerAddAction( t, function Order )

set caster=xecast.createBasic(DUMMY_SPELL, OrderId(DUMMY_SPELL_ORDER), Player(12))
call RegisterSpellEffectResponse(MERGE_ABILITY, SpellEffect)
call XE_PreloadAbility(DUMMY_SPELL)
endfunction
endscope
Forum Nav : Jump To This Forum
Blizzard Entertainment