Inscrit le: 12 Sep 2009 Messages: 801 Sujets: 64 Spécialité en worldedit: Ne pas.
Posté le: 09/07/11 23:25 Sujet du message: TotemMortel
Jass:
//=====
//(Spell) Totem Mortel
//By DaKanibal
//=====
//Version 1.00
//uC = (unit) Caster
//uDD = (unit) Totem Mortel
//rDmg = (real) Damage to targets
//lC = (location) Caster position
//uG = (group unit) Unit in 400 of lC (alive and ennemy of uC)
//rU = (unit) Random unit from uG
//i/i2 = for loop
//l = (location) rU location
//lDD = (location) uDD position
function FilterEnnemyAndAlive takes nothing returns boolean
local unit uC = GetTriggerUnit()
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(uC)) and IsUnitAliveBJ(GetFilterUnit())
endfunction
function ApplyDamages takes real r, group g, unit u returns nothing
local group uG
local unit rU
local unit uC
local real rDmg
local integer i
local integer i2
local location l
set i2 = CountUnitsInGroup(uG)
set rDmg = r
set uC = u
set uG = g
loop
exitwhen (i > i2)
//====
set rU = GroupPickRandomUnit(uG)
set l = GetUnitLoc(rU)
call UnitDamageTarget(uC, rU, rDmg, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
call GroupRemoveUnitSimple(rU, uG)
call AddSpecialEffectBJ(l, "Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl")
call DestroyEffect(GetLastCreatedEffectBJ())
set i = i + 1
//====
endloop
endfunction
function TM takes nothing returns nothing
local unit uC = GetTriggerUnit()
local unit uDD = null
local real rDmg
local location lC = GetUnitLoc(uC)
local location lDD = null
local group uG = null
//====
if ( not (GetSpellAbilityId() != 'A002' ) ) then
call CreateNUnitsAtLoc(1, 'o002',GetOwningPlayer(uC), lC,180.0)
set uDD = GetLastCreatedUnit()
call UnitApplyTimedLife(uDD, 'BTLF', 5.00)
call TriggerSleepAction(5.00)
call AddSpecialEffectLocBJ(lDD, "Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl")
call DestroyEffect(GetLastCreatedEffectBJ())
set uG = GetUnitsInRangeOfLocMatching(400.00, lC, Filter(function FilterEnnemyAndAlive))
set rDmg = I2R(GetHeroLevel(uC)) * I2R(GetUnitAbilityLevelSwapped('A0E3'))
call ApplyDamages(rDmg, uG, uC)
endif
endfunction
//===========================================================================
function InitTrig_Totem_Mortel takes nothing returns nothing
set gg_trg_Totem_Mortel = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Totem_Mortel, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Totem_Mortel, function TM )
endfunction
Inscrit le: 21 Fév 2010 Messages: 1785 Sujets: 22 Spécialité en worldedit: La modestie Médailles: 1 (En savoir plus...)
Posté le: 10/07/11 11:13 Sujet du message:
Ça a plutôt sa place dans la partie "Les sorts -> Modèles" .
Comme je suis sympa, je te fais la version jass (taunt inside) :
Jass:
//=====
//(Spell) Totem Mortel
//By DaKanibal
//=====
//Version 1.00
//uC = (unit) Caster
//uDD = (unit) Totem Mortel
//rDmg = (real) Damage to targets
//uG = (group unit) Unit in 400 of lC (alive and ennemy of uC)
//rU = (unit) Random unit from uG
function FilterEnnemyAndAlive takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0.407
endfunction
function ApplyDamages takes unit caster, group targets, real damages returns nothing
local unit rU
loop
set rU = FirstOfGroup(targets)
exitwhen rU == null
//====
call UnitDamageTarget(caster, rU, damages, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl", GetUnitX(rU), GetUnitY(rU)))
call GroupRemoveUnit(targets, rU)
//====
endloop
endfunction
function TM takes nothing returns nothing
local unit uC
local real xC
local real yC
local group uG
//====
if ( GetSpellAbilityId() == 'A002' ) then
set uC = GetTriggerUnit()
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(uC), 'o002', xC, yC, 180.0), 'BTLF', 5.00)
call TriggerSleepAction(5.00)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl", xC, yC))
set uG = CreateGroup()
call GroupEnumUnitsInRange(uG, xC, yC, 400.00, Filter(function FilterEnnemyAndAlive))
call ApplyDamages(uC, uG, GetHeroLevel(uC) * GetUnitAbilityLevel(uC, 'A0E3'))
call DestroyGroup(uG)
set uG = null
set uC = null
endif
endfunction
//===========================================================================
function InitTrig_Totem_Mortel takes nothing returns nothing
set gg_trg_Totem_Mortel = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Totem_Mortel, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Totem_Mortel, function TM )
endfunction
Y'avait des erreurs dans ta version et c'est pas intéressant de copier le déclencheur si on n'a pas les bonnes données dans l'éditeur d'objet. _________________
Vous ne pouvez pas poster de nouveaux sujets dans ce forum Vous ne pouvez pas répondre aux sujets dans ce forum Vous ne pouvez pas éditer vos messages dans ce forum Vous ne pouvez pas supprimer vos messages dans ce forum Vous ne pouvez pas voter dans les sondages de ce forum