- Joined
- Sep 19, 2006
- Messages
- 152
I've only been at this about a week, so please forgive my noobiness. Here's my first trigger, but I have a few problems. Firstly, I'd like the trigger to have no effect on FRIENDLY undead units, but don't know how to include that stipulation in the first portion of the trigger. Secondly, because of the Polar Pojection command near the middle of the trigger, I had to use Locations rather than (RealX, RealY). Does anyone know how to calculate the angle between 2 points using only 2 sets of RealX and RealY? Thanks for the feedback.
(In case you're wondering, "Wisdom" here is a substitute for "Agility".)
___________
DIVINE LIGHT
Channels the Paladin's devotion into a flash of brilliant light, healing friendly living units and repeling the enemy Undead. Each point of base Wisdom increases the amount healed by 25, while each point of Wisdom obtained from items increases this healing by 10.
Level 1 - Heals 100 life excluding the Wisdom bonus
Level 2 - Heals 150 life excluding the Wisdom bonus
Level 3 - Heals 200 life excluding the Wisdom bonus
Level 4 - Heals 250 life excluding the Wisdom bonus
Level 5 - Heals 300 life excluding the Wisdom bonus
Level 6 - Heals 350 life excluding the Wisdom bonus
Level 7 - Heals 400 life excluding the Wisdom bonus
Level 8 - Heals 450 life excluding the Wisdom bonus
function AbilityDivineLight_Condition01 takes nothing returns boolean
return GetAbilityName (GetSpellAbilityId()) == "Paladin - Divine Light"
endfunction
function AbilityDivineLight_Action01 takes nothing returns nothing
local unit DivineLightCastingUnit = GetSpellAbilityUnit()
local player DivineLightPlayer = GetOwningPlayer (DivineLightCastingUnit)
local integer DivineLightSpecialValueA = (((GetUnitAbilityLevelSwapped (GetSpellAbilityId(), DivineLightCastingUnit) *50) +50) + ((GetHeroStatBJ (bj_HEROSTAT_AGI, DivineLightCastingUnit, false) * 15) + (GetHeroStatBJ (bj_HEROSTAT_AGI, DivineLightCastingUnit, true) * 10)))
local integer DivineLightSpecialValueB = (GetUnitAbilityLevelSwapped (GetSpellAbilityId(), DivineLightCastingUnit) * 250) + 750
local real DivineLightTargetUnitMoveSpeed
local location DivineLightCastingUnitLocation = GetUnitLoc (DivineLightCastingUnit)
local real DivineLightCastingUnitX = GetUnitX (DivineLightCastingUnit)
local real DivineLightCastingUnitY = GetUnitY (DivineLightCastingUnit)
local group DivineLightTargetGroupA = CreateGroup()
local group DivineLightTargetGroupB = CreateGroup()
local unit DivineLightTargetUnit
local location DivineLightTargetUnitLocationA
local location DivineLightTargetUnitLocationB
call TriggerSleepAction (0.75)
call GroupEnumUnitsInRange (DivineLightTargetGroupA, DivineLightCastingUnitX, DivineLightCastingUnitY, 550.0, null)
loop
set DivineLightTargetUnit = FirstOfGroup (DivineLightTargetGroupA)
exitwhen DivineLightTargetUnit == null
if IsUnitAlly (DivineLightTargetUnit, DivineLightPlayer) then
call SetUnitLifeBJ (DivineLightTargetUnit, (GetUnitStateSwap (UNIT_STATE_LIFE, DivineLightTargetUnit) + (DivineLightSpecialValueA)))
elseif IsUnitEnemy (DivineLightTargetUnit, DivineLightPlayer) and IsUnitRace (DivineLightTargetUnit, RACE_UNDEAD) then
set DivineLightTargetUnitMoveSpeed = GetUnitMoveSpeed (DivineLightTargetUnit) +135
set DivineLightTargetUnitLocationA = GetUnitLoc(DivineLightTargetUnit)
set DivineLightTargetUnitLocationB = PolarProjectionBJ (DivineLightTargetUnitLocationA, DivineLightSpecialValueB, AngleBetweenPoints (DivineLightCastingUnitLocation, DivineLightTargetUnitLocationA))
call GroupAddUnit (DivineLightTargetGroupB, DivineLightTargetUnit)
call SetUnitMoveSpeed (DivineLightTargetUnit, DivineLightTargetUnitMoveSpeed)
call IssuePointOrderLoc (DivineLightTargetUnit, "move", DivineLightTargetUnitLocationB)
call RemoveLocation (DivineLightTargetUnitLocationA)
call RemoveLocation (DivineLightTargetUnitLocationB)
endif
call GroupRemoveUnit (DivineLightTargetGroupA, DivineLightTargetUnit)
set DivineLightTargetUnit = null
endloop
call TriggerSleepAction (2.0)
loop
set DivineLightTargetUnit = FirstOfGroup (DivineLightTargetGroupB)
exitwhen DivineLightTargetUnit == null
set DivineLightTargetUnitMoveSpeed = GetUnitMoveSpeed (DivineLightTargetUnit) -135
call SetUnitMoveSpeed (DivineLightTargetUnit, DivineLightTargetUnitMoveSpeed)
call GroupRemoveUnit (DivineLightTargetGroupB, DivineLightTargetUnit)
set DivineLightTargetUnit = null
endloop
call DestroyGroup (DivineLightTargetGroupA)
call DestroyGroup (DivineLightTargetGroupB)
call RemoveLocation (DivineLightCastingUnitLocation)
set DivineLightCastingUnit = null
endfunction
function InitTrig_AbilityDivineLight takes nothing returns nothing
set gg_trg_AbilityDivineLight = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ (gg_trg_AbilityDivineLight, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition (gg_trg_AbilityDivineLight, Condition (function AbilityDivineLight_Condition01))
call TriggerAddAction (gg_trg_AbilityDivineLight, function AbilityDivineLight_Action01)
endfunction
(In case you're wondering, "Wisdom" here is a substitute for "Agility".)
___________
DIVINE LIGHT
Channels the Paladin's devotion into a flash of brilliant light, healing friendly living units and repeling the enemy Undead. Each point of base Wisdom increases the amount healed by 25, while each point of Wisdom obtained from items increases this healing by 10.
Level 1 - Heals 100 life excluding the Wisdom bonus
Level 2 - Heals 150 life excluding the Wisdom bonus
Level 3 - Heals 200 life excluding the Wisdom bonus
Level 4 - Heals 250 life excluding the Wisdom bonus
Level 5 - Heals 300 life excluding the Wisdom bonus
Level 6 - Heals 350 life excluding the Wisdom bonus
Level 7 - Heals 400 life excluding the Wisdom bonus
Level 8 - Heals 450 life excluding the Wisdom bonus
function AbilityDivineLight_Condition01 takes nothing returns boolean
return GetAbilityName (GetSpellAbilityId()) == "Paladin - Divine Light"
endfunction
function AbilityDivineLight_Action01 takes nothing returns nothing
local unit DivineLightCastingUnit = GetSpellAbilityUnit()
local player DivineLightPlayer = GetOwningPlayer (DivineLightCastingUnit)
local integer DivineLightSpecialValueA = (((GetUnitAbilityLevelSwapped (GetSpellAbilityId(), DivineLightCastingUnit) *50) +50) + ((GetHeroStatBJ (bj_HEROSTAT_AGI, DivineLightCastingUnit, false) * 15) + (GetHeroStatBJ (bj_HEROSTAT_AGI, DivineLightCastingUnit, true) * 10)))
local integer DivineLightSpecialValueB = (GetUnitAbilityLevelSwapped (GetSpellAbilityId(), DivineLightCastingUnit) * 250) + 750
local real DivineLightTargetUnitMoveSpeed
local location DivineLightCastingUnitLocation = GetUnitLoc (DivineLightCastingUnit)
local real DivineLightCastingUnitX = GetUnitX (DivineLightCastingUnit)
local real DivineLightCastingUnitY = GetUnitY (DivineLightCastingUnit)
local group DivineLightTargetGroupA = CreateGroup()
local group DivineLightTargetGroupB = CreateGroup()
local unit DivineLightTargetUnit
local location DivineLightTargetUnitLocationA
local location DivineLightTargetUnitLocationB
call TriggerSleepAction (0.75)
call GroupEnumUnitsInRange (DivineLightTargetGroupA, DivineLightCastingUnitX, DivineLightCastingUnitY, 550.0, null)
loop
set DivineLightTargetUnit = FirstOfGroup (DivineLightTargetGroupA)
exitwhen DivineLightTargetUnit == null
if IsUnitAlly (DivineLightTargetUnit, DivineLightPlayer) then
call SetUnitLifeBJ (DivineLightTargetUnit, (GetUnitStateSwap (UNIT_STATE_LIFE, DivineLightTargetUnit) + (DivineLightSpecialValueA)))
elseif IsUnitEnemy (DivineLightTargetUnit, DivineLightPlayer) and IsUnitRace (DivineLightTargetUnit, RACE_UNDEAD) then
set DivineLightTargetUnitMoveSpeed = GetUnitMoveSpeed (DivineLightTargetUnit) +135
set DivineLightTargetUnitLocationA = GetUnitLoc(DivineLightTargetUnit)
set DivineLightTargetUnitLocationB = PolarProjectionBJ (DivineLightTargetUnitLocationA, DivineLightSpecialValueB, AngleBetweenPoints (DivineLightCastingUnitLocation, DivineLightTargetUnitLocationA))
call GroupAddUnit (DivineLightTargetGroupB, DivineLightTargetUnit)
call SetUnitMoveSpeed (DivineLightTargetUnit, DivineLightTargetUnitMoveSpeed)
call IssuePointOrderLoc (DivineLightTargetUnit, "move", DivineLightTargetUnitLocationB)
call RemoveLocation (DivineLightTargetUnitLocationA)
call RemoveLocation (DivineLightTargetUnitLocationB)
endif
call GroupRemoveUnit (DivineLightTargetGroupA, DivineLightTargetUnit)
set DivineLightTargetUnit = null
endloop
call TriggerSleepAction (2.0)
loop
set DivineLightTargetUnit = FirstOfGroup (DivineLightTargetGroupB)
exitwhen DivineLightTargetUnit == null
set DivineLightTargetUnitMoveSpeed = GetUnitMoveSpeed (DivineLightTargetUnit) -135
call SetUnitMoveSpeed (DivineLightTargetUnit, DivineLightTargetUnitMoveSpeed)
call GroupRemoveUnit (DivineLightTargetGroupB, DivineLightTargetUnit)
set DivineLightTargetUnit = null
endloop
call DestroyGroup (DivineLightTargetGroupA)
call DestroyGroup (DivineLightTargetGroupB)
call RemoveLocation (DivineLightCastingUnitLocation)
set DivineLightCastingUnit = null
endfunction
function InitTrig_AbilityDivineLight takes nothing returns nothing
set gg_trg_AbilityDivineLight = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ (gg_trg_AbilityDivineLight, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition (gg_trg_AbilityDivineLight, Condition (function AbilityDivineLight_Condition01))
call TriggerAddAction (gg_trg_AbilityDivineLight, function AbilityDivineLight_Action01)
endfunction