Chaos_Knight
New Member
- Reaction score
- 39
Okay, ive started to make a BIG update to my spell.
It's now active, and it dont work. The ActionsAddSpell, can also be the problem. I also have checked up all id IDs of the spells. They are right.
Thanks for your help.
//Chaos_Knight
PS: Laiev and BlackRose, this is just the start...
JASS:
library MovingStrike initializer Init requires Damage
// +-------------------------------------------------------------------------------+
// | Moving Strikes - Created by Chaos_Knight. Requires a vJass preprocessor! |
// +-------------------------------------------------------------------------------+
// | Gives a chance to move the attacker behind the unit which is attacked, |
// | and deal damage. |
// +-------------------------------------------------------------------------------+
// | How to Import: |
// | - Create a new trigger |
// | - Convert it to Custom text (Edit > Convert to Custom Text) |
// | - Replace everything there with this code |
// | - Change the constants to suit yourself |
// | - Enjoy! |
// +-------------------------------------------------------------------------------+
// |-------------|
// | Constants: |
// |-------------|
globals
/*Model*/
//----------------------------------------------------------------------------------------------+
private constant string EFFECT = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl"
//----------------------------------------------------------------------------------------------+
private constant string EFFECT2 = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"
//----------------------------------------------------------------------------------------------+
private constant string EFFECT3 = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
//----------------------------------------------------------------------------------------------+
private constant string EFFECT4 = "Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"
//----------------------------------------------------------------------------------------------+
private constant string EFFECT6 = "Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl"
/*End of Model Editing*/
/*Attached To? */
//----------------------------------------------------------------------------------------------+
private constant string EFFECT_POSITION = "weapon,left"
//----------------------------------------------------------------------------------------------+
private constant string EFFECTPOSITION = "hand,right"
//----------------------------------------------------------------------------------------------+
private constant string EFFECTPOS = "origin"
//----------------------------------------------------------------------------------------------+
/* End Of Attachments*/
//----------------------------------------------------------------------------------------------+
private constant boolean IS_RANGED = true
//----------------------------------------------------------------------------------------------+
private constant boolean IS_MEELE = true
private constant real DELAYTIME = 0.
//----------------------------------------------------------------------------------------------+
/* Color Red of The TextTag*/
private constant integer RED = 255
//----------------------------------------------------------------------------------------------+
/* Color Green of the TextTag*/
private constant integer GREEN = 0
//----------------------------------------------------------------------------------------------+
/* Color Blue of the TextTag*/
private constant integer BLUE = 0
//----------------------------------------------------------------------------------------------+
/* Visibilty of the TextTag*/
private constant integer ALPHA = 255
//----------------------------------------------------------------------------------------------+
/* If true, shows the texttag*/
private constant boolean SHOWDAMAGE = true
//----------------------------------------------------------------------------------------------+
/*Damage dealt * The unit ability lvl*/
private constant integer DAMAGE = 35
//----------------------------------------------------------------------------------------------+
/* Chance of triggering this trigger*/
private constant integer CHANCE = 100
/* 100% chance is for testing purposes. If you dont want this to be imba, have it on 2.*/
//----------------------------------------------------------------------------------------------+
/* How Long Moving */
private constant integer FROMTARGET = 128
//----------------------------------------------------------------------------------------------+
/* Attack Type */
private constant attacktype AtkType = ATTACK_TYPE_CHAOS
//----------------------------------------------------------------------------------------------+
/* Damage Type */
private constant damagetype DmgType = DAMAGE_TYPE_FIRE
//----------------------------------------------------------------------------------------------+
/* Weapon Type */
private constant weapontype WepType = WEAPON_TYPE_WHOKNOWS
//----------------------------------------------------------------------------------------------+
/* Your spells ID */
private constant integer ID = 039;A002039;
private constant integer SPELLID = 039;A003039;
private constant integer ADDIDSPELLBOOK = 039;A001039;
//----------------------------------------------------------------------------------------------+
//| E N D |
//| O F |
//| C O N I F I G U R A B L E S|
unit u = GetEventDamageSource()
unit t = GetTriggerUnit()
player playcast = GetOwningPlayer( u )
endglobals
private constant function DELAY takes integer LvL returns real
return 0.5 * LvL * LvL + 4.5 * LvL + 7
endfunction
private constant function CHANC takes integer level returns integer
return CHANCE * level
endfunction
private constant function DMG takes integer Lvl returns integer
return DAMAGE * Lvl
endfunction
// |------------------|
// | End of Constants |
// |------------------|
// DO NOT EDIT BELOW THIS LINE!
private function Cons takes nothing returns boolean
return IsUnitEnemy(u , playcast) /*
*/and GetRandomInt(0, 100) <= CHANC(GetUnitAbilityLevel(u, ID)) /*
*/and not IsUnitType(t, UNIT_TYPE_HERO) /*
*/and GetUnitAbilityLevel(u , ID) > 0 /*
*/and Damage_IsAttack() == TRUE
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A003039;
endfunction
private function ActionsAddSpell takes nothing returns nothing
call UnitAddAbility( u , ADDIDSPELLBOOK )
call BJDebugMsg("Ability Added")
call SetUnitAbilityLevel( u , SPELLID , GetUnitAbilityLevel( u , ID ))
call SetPlayerAbilityAvailable( playcast , ADDIDSPELLBOOK , false )
call TriggerSleepAction(DELAY(GetUnitAbilityLevel(u , ID )))
call UnitRemoveAbility( u , ADDIDSPELLBOOK)
endfunction
private function Moving takes nothing returns nothing
local real CasterX = GetUnitX( u )
local real CasterY = GetUnitY( u )
local real TargetX = GetUnitX( t )
local real TargetY = GetUnitY( t )
local real angle = Atan2(TargetY - TargetY, CasterX - CasterY)
local texttag TT
call DestroyEffect(AddSpecialEffectTarget(EFFECT, u, EFFECT_POSITION))
call DestroyEffect(AddSpecialEffectTarget(EFFECT2, u, EFFECTPOSITION))
call DestroyEffect(AddSpecialEffectTarget(EFFECT3, t, EFFECTPOS))
call DestroyEffect(AddSpecialEffectTarget(EFFECT4, t, EFFECTPOS))
call DestroyEffect(AddSpecialEffectTarget(EFFECT6, t, EFFECTPOS))
static if SHOWDAMAGE then
set TT = CreateTextTag()
call SetTextTagText (TT,R2S(DMG(GetUnitAbilityLevel(u, ID))) + "!", 0.023)
call SetTextTagPosUnit (TT, u, 10 )
call SetTextTagColor (TT, RED, GREEN, BLUE, 255 )
call SetTextTagVelocity (TT, 0.0355 * Cos(90. * bj_DEGTORAD), 0.0355 * Sin(90. * bj_DEGTORAD))
call SetTextTagVisibility (TT, true)
call SetTextTagFadepoint (TT, 2.00)
call SetTextTagLifespan (TT, 2.00)
call SetTextTagPermanent (TT, false)
endif
call SetUnitX( u , CasterX + FROMTARGET * Cos(angle))
call SetUnitY( u , CasterY + FROMTARGET * Sin(angle))
call Damage_EnableEvent(false)
call UnitDamageTargetEx( u , t , DMG(GetUnitAbilityLevel(u, ID)) , IS_RANGED , IS_MEELE , AtkType , DmgType , WepType )
call Damage_EnableEvent(true)
set u = null
set TT = null
set t = null
endfunction
//------------------------------------------------------------------
private function Init takes nothing returns nothing
local trigger tr = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( tr , EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( tr , Condition( function Conditions))
call TriggerAddAction( tr , function ActionsAddSpell)
call Damage_RegisterEvent(tr)
call TriggerAddCondition( tr , Condition(function Cons))
call TriggerAddAction( tr , function Moving)
set tr = null
endfunction
//----------------------+
//END OF MOVING STRIKES |
//----------------------+
endlibrary
It's now active, and it dont work. The ActionsAddSpell, can also be the problem. I also have checked up all id IDs of the spells. They are right.
Thanks for your help.
//Chaos_Knight
PS: Laiev and BlackRose, this is just the start...