Jonnycakes
New Member
- Reaction score
- 6
Hi, I am trying to make scroll of town portal item that can target any point on the map. Since both scroll of town portal and staff of teleportation must target units, I used channel as a dummy spell and added effects to it. I am having trouble with the triggers that move the unit, though. I have a couple of questions...
Is there a way to get the spell target of a channeled spell in a trigger whose event is EVENT_PLAYER_UNIT_SPELL_FINISH or EVENT_PLAYER_UNIT_SPELL_ENDCAST? I have tried, and the trigger just moves the unit to the center of the map by default.
I want the portal ability to be interrupted by stuns and the like, so that is why I have a trigger that runs upon finishing. For the special effect, I have a trigger that runs when the spell starts channeling, waits a couple seconds, then creates the special effects. I would like these to stop if the unit is stunned, too. Is there a cleaner way to structure these triggers?
Here are the triggers I'm using:
Is there a way to get the spell target of a channeled spell in a trigger whose event is EVENT_PLAYER_UNIT_SPELL_FINISH or EVENT_PLAYER_UNIT_SPELL_ENDCAST? I have tried, and the trigger just moves the unit to the center of the map by default.
I want the portal ability to be interrupted by stuns and the like, so that is why I have a trigger that runs upon finishing. For the special effect, I have a trigger that runs when the spell starts channeling, waits a couple seconds, then creates the special effects. I would like these to stop if the unit is stunned, too. Is there a cleaner way to structure these triggers?
Here are the triggers I'm using:
JASS:
scope portaleffect initializer init
private function conditions takes nothing returns boolean
return GetSpellAbilityId()==039;A010039;
endfunction
private function actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local location l=GetSpellTargetLoc()
call TriggerSleepAction(2.7)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", x, y))
call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", l))
call RemoveLocation(l)
set l=null
set u=null
endfunction
//===========================================================================
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
local integer i=0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set i=i+1
exitwhen i==8
endloop
call TriggerAddCondition(t, Condition(function conditions))
call TriggerAddAction(t, function actions)
endfunction
endscope
scope portalwarp initializer init
private function conditions takes nothing returns boolean
return GetSpellAbilityId()==039;A010039;
endfunction
private function actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local location l=GetSpellTargetLoc()
call SetUnitPositionLoc(u, l)
call RemoveLocation(l)
set l=null
set u=null
endfunction
//===========================================================================
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
local integer i=0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_FINISH, null)
set i=i+1
exitwhen i==8
endloop
call TriggerAddCondition(t, Condition(function conditions))
call TriggerAddAction(t, function actions)
endfunction
endscope