HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trouble with Blade DK's Spellpack

09-10-2009, 01:34 PM#1
Frostmagus777
Hello. I've just installed Blade DK's spellpack:
HTML Code:
http://www.wc3c.net/showthread.php?p=1104537#post1104537
The spells works fine, however there is one small little problem, as I've stated in a reply on the link above. Basically what's happening is: when the spell is cast with units nearby they are 'Dot'd' as normal however on the last unit affected, a copy of the casting unit (could be an animation, maybe even a dummy to the spell) is left on the position of the unit (Not attached to the unit though). This caster copy remains there permanently until the spell is cast again on another unit, where a new copy is left. This problem doesn't occur if no units are affected by the spell. Here is a screenshot of the issue.

If somebody could please help me with this, I would be very grateful, and will be rewarded with rep. Thank you
09-10-2009, 04:48 PM#2
Frostmagus777
First of all allow me to apologise for the double post. If anybody needs more information about this issue i.e more specific details, then please reply with what additional information you need and ill post it for you. Thanks again
09-10-2009, 04:59 PM#3
ploks
I think that creating a post in the original thread would be better. Seems a bit oddly placed here.

And use edit instead of a double post next time. ;)
09-10-2009, 05:04 PM#4
Frostmagus777
I have created a post in the original, but its over 3 years old and will probobly go down more unoticed than this one.
09-10-2009, 05:29 PM#5
Themerion
Quote:
If anybody needs more information about this issue i.e more specific details, then please reply with what additional information you need and ill post it for you.

Well... you could post the actual script? (use [script] and [/script]-tags)

Quote:
think that creating a post in the original thread would be better. Seems a bit oddly placed here.

You think that he should revive a 3 year old thread, in order to ask the author who hasn't been around for ages?
09-10-2009, 05:47 PM#6
ploks
Quote:
Originally Posted by Themerion

You think that he should revive a 3 year old thread, in order to ask the author who hasn't been around for ages?

I think that I'm lazy and didn't check the link. Sorry for the mistake.
09-10-2009, 06:43 PM#7
TKF
Quote:
Originally Posted by Frostmagus777
I have created a post in the original, but its over 3 years old and will probobly go down more unoticed than this one.
Believe me. People here notice necroposting much better than radnom threads. Admins have eyes everywhere here.
09-10-2009, 07:40 PM#8
Frostmagus777
Collapse JASS:
 //TESH.scrollpos=9
//TESH.alwaysfold=0
//***************************************************************************
//*                                                                         *
//* ToxicSliver - A JESP spell by Blade.dk                                  *
//*                                              [url]http://aaa.wc3jass.com[/url]     *
//*                                                                         *
//***************************************************************************
//===========================================================================
// ToxicSliver spell configuration section
constant function ToxicSliver_SpellId takes nothing returns integer
    return 'A00C' // Rawcode of the ToxicSliver spell.
endfunction

constant function ToxicSliver_AnimationIndex takes nothing returns integer
    return 0 // The index of the animation the spell plays when the caster moves.
endfunction

constant function ToxicSliver_Speed takes real level returns real
    return 800.00+0.00*level // How fast the unit moves (distance moved per in-game second).
endfunction

constant function ToxicSliver_Area takes real level returns real
    return 180.00+0.00*level // How close an enemy unit must be to the caster to be affected by the spell.
endfunction

constant function ToxicSliver_EffectWaitDistance takes real level returns real
    return 65.00 // How long a distance the caster moves before an effect is created behind it.
endfunction

constant function ToxicSliver_MinDist takes nothing returns real
    return 250.00 // The minimum range of the spell.
endfunction

constant function ToxicSliver_InvulnerableWhileSlivering takes integer level returns boolean
    return false // This should be true if the caster is supposed to be invulnerable during the spell's
// effect, and false if it should not (the spell will stop if the unit dies then).
endfunction

constant function ToxicSliver_Period takes nothing returns real
    return 0.04 // How often the caster moves. This does not affect the speed itself.
// A low value like 0.01 looks best, but has a greater chance to cause lag, a high value like 0.1 doesn't
// look to well. 0.05 seems to look nice and is efficient enough for me.
endfunction

constant function ToxicSliver_Error takes nothing returns string
    return "Target is inside minimum range." // The error message displayed when the targeted points is
// inside the minimum range.
endfunction

constant function ToxicSliver_InitialDamage takes real level returns real
    return 10.00*(level+1.00) // The initial damage done by the Shadow Strike.
endfunction

constant function ToxicSliver_PeriodicDamage takes real level returns real
    return 2+3*level // The damage done by the Shadow Strike every <DamagePeriod> seconds.
endfunction

constant function ToxicSliver_DamagePeriod takes real level returns real
     return 1.00 // How often units are damaged by the Shadow Strike.
endfunction

constant function ToxicSliver_DamageDuration takes real level returns real
    return 10+0*level // How long time the Shadow Strike will last.
endfunction

//===========================================================================
// ToxicSliver code
// Author: Blade.dk
function ToxicSliver_ShadowStrike_Damage takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local string s = GetAttachmentTable(t)
    local unit u = GetTableUnit(s, "target")
    local integer i = GetTableInt(s, "level")
    local real r = ToxicSliver_PeriodicDamage(i)
    if GetUnitState(u, UNIT_STATE_LIFE) > 0 then
        call UnitDamageTarget(GetTableUnit(s, "hurter"), u, r, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_SHADOW_STRIKE, null)
        call AddFadingTextTag(I2S(R2I(r)), GetUnitX(u), GetUnitY(u), 160, 255, 0, 255)
    endif
    set r = GetTableReal(s, "timeelapsed")+ToxicSliver_DamagePeriod(i)
    if GetUnitState(u, UNIT_STATE_LIFE) <= 0 or r >= ToxicSliver_DamageDuration(i) then
        call AttachBoolean(u, "ToxicSliver_Affected", false)
        call DestroyEffect(GetTableEffect(s, "effect"))
        call ClearTable(s)
        call DestroyTimer(t)
    else
        call SetTableReal(s, "timeelapsed", r)
    endif
    set t = null
    set u = null
endfunction

function ToxicSliver_ShadowStrike takes unit u, unit h, integer l returns nothing
    local timer t = CreateTimer()
    local string s = GetAttachmentTable(t)
    local real r = ToxicSliver_InitialDamage(l)
    call SetTableObject(s, "target", u)
    call SetTableObject(s, "hurter", h)
    call SetTableInt(s, "level", l)
    call AttachBoolean(u, "ToxicSliver_Affected", true)
    call UnitDamageTarget(h, u, r, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_SHADOW_STRIKE, null)
    call AddFadingTextTag(I2S(R2I(r))+"!", GetUnitX(u), GetUnitY(u), 160, 255, 0, 255)
    set l = ToxicSliver_SpellId()
    call SetTableObject(s, "effect", AddSpecialEffectTarget(GetAbilityEffectById(l, EFFECT_TYPE_TARGET, 1), u, GetAbilityEffectById(l, EFFECT_TYPE_TARGET, 2)))
    call TimerStart(t, ToxicSliver_DamagePeriod(l), true, function ToxicSliver_ShadowStrike_Damage)
    set t = null
endfunction

function ToxicSliver_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == ToxicSliver_SpellId()
endfunction

function ToxicSliver_Filter takes nothing returns boolean
    local string s = GetAttachmentTable(GetExpiredTimer())
    return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetTableUnit(s, "caster"))) and (not (GetAttachedBoolean(GetFilterUnit(), "ToxicSliver_Affected"))) and ( not IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING) ) and not IsUnitInvulnerable(GetFilterUnit())
endfunction

function ToxicSliver_Move takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local string s = GetAttachmentTable(t)
    local unit c = GetTableUnit(s, "caster")
    local integer i = GetTableInt(s, "level")
    local real r = GetTableReal(s, "speed")
    local real a = GetTableReal(s, "ang")
    local real x = GetUnitX(c)+r*Cos(a)
    local real y = GetUnitY(c)+r*Sin(a)
    local real dc = GetTableReal(s, "dc")+r
    local real ox = GetTableReal(s, "x")
    local real oy = GetTableReal(s, "y")
    local group g = CreateGroup()
    local boolexpr b = Condition(function ToxicSliver_Filter)
    local unit f
    local player p = GetOwningPlayer(c)
    local real e = GetTableReal(s, "moves")
    local real n = GetTableReal(s, "neededmoves")
    call GroupEnumUnitsInRange(g, x, y, ToxicSliver_Area(i), b)
    loop
        set f = FirstOfGroup(g)
        exitwhen f == null
        call ToxicSliver_ShadowStrike(f, c, i)
        call GroupRemoveUnit(g, f)
    endloop
    call CS_MoveUnit(c, x, y)
    if dc >= ToxicSliver_EffectWaitDistance(i) then
        call DestroyEffect(AddSpecialEffect(GetAbilityEffectById(ToxicSliver_SpellId(), EFFECT_TYPE_TARGET, 0), ox, oy))
        call SetTableReal(s, "x", x)
        call SetTableReal(s, "y", y)
        call SetTableReal(s, "dc", 0)
    else
        call SetTableReal(s, "dc", dc)
    endif
    if e >= n or not( GetUnitState(c, UNIT_STATE_LIFE) > 0) then
        call PauseUnit(c, false)
        call SetUnitPathing(c, true)
        if ToxicSliver_InvulnerableWhileSlivering(i) then
            call SetUnitInvulnerable(c, false)
        endif
        call ResetUnitAnimation(c)
        call ClearTable(s)
        call DestroyTimer(t)
    else
        call SetTableReal(s, "moves", e+1)
    endif
    set t = null
    set c = null
    call DestroyGroup(g)
    set g = null
    call DestroyBoolExpr(b)
    set b = null
    set f = null
    set p = null
endfunction

function ToxicSliver_Actions takes nothing returns nothing
    local unit c = GetSpellAbilityUnit()
    local location l = GetSpellTargetLoc()
    local location p = GetUnitLoc(c)
    local real d = DistanceBetweenPoints(l, p)
    local timer t = CreateTimer()
    local string s = GetAttachmentTable(t)
    local integer v = GetUnitAbilityLevel(c, ToxicSliver_SpellId())
    local real x = GetUnitX(c)
    local real y = GetUnitY(c)
    local real tx = GetLocationX(l)
    local real ty = GetLocationY(l)
    local real e = ToxicSliver_Speed(v)*ToxicSliver_Period()
    call PauseUnit(c, true)
    call SetUnitAnimationByIndex(c, ToxicSliver_AnimationIndex())
    call SetUnitPathing(c, false)
    if ToxicSliver_InvulnerableWhileSlivering(v) then
        call SetUnitInvulnerable(c, true)
    endif
    call SetTableObject(s, "caster", c)
    call SetTableInt(s, "level", v)
    call SetTableReal(s, "dist", d)
    call SetTableReal(s, "ang", Atan2(ty - y, tx - x))
    call SetTableReal(s, "neededmoves", d/e-1)
    call SetTableReal(s, "speed", e)
    call SetTableReal(s, "x", x)
    call SetTableReal(s, "y", y)
    call SetTableReal(s, "tx", tx)
    call SetTableReal(s, "ty", ty)
    call TimerStart(t, ToxicSliver_Period(), true, function ToxicSliver_Move)
    set c = null
    call RemoveLocation(l)
    set l = null
    call RemoveLocation(p)
    set p = null
    set t = null
endfunction

function ToxicSliver_Check takes nothing returns nothing
    local unit c = GetSpellAbilityUnit()
    local location l = GetSpellTargetLoc()
    local real x = GetUnitX(c) - GetLocationX(l)
    local real y = GetUnitY(c) - GetLocationY(l)
    local real d = ToxicSliver_MinDist()
    if x*x + y*y < d*d then
        call IssueImmediateOrder(c, "stop")
        call SimError(GetOwningPlayer(c), ToxicSliver_Error())
    endif
    set c = null
    call RemoveLocation(l)
    set l = null
endfunction

//===========================================================================
function InitTrig_ToxicSliver takes nothing returns nothing
    local trigger t = CreateTrigger()
    set gg_trg_ToxicSliver = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_ToxicSliver, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_ToxicSliver, Condition( function ToxicSliver_Conditions ) )
    call TriggerAddAction( gg_trg_ToxicSliver, function ToxicSliver_Actions )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( t, Condition( function ToxicSliver_Conditions ) )
    call TriggerAddAction( t, function ToxicSliver_Check )
    call Preload(GetAbilityEffectById(ToxicSliver_SpellId(), EFFECT_TYPE_TARGET, 0))
    call Preload(GetAbilityEffectById(ToxicSliver_SpellId(), EFFECT_TYPE_TARGET, 1))
    set t = null
endfunction 
09-11-2009, 02:59 AM#9
Av3n
Make note that this spell broke with the new patch ^^. Try updating the Caster System in the test map with the latest one and see if that works

-Av3n
09-11-2009, 08:20 AM#10
Flame_Phoenix
Or ... you can always try and remake it xD
09-11-2009, 12:19 PM#11
Frostmagus777
Ok ive put CS 16.0 onto my map, ive changed the casterunit_id accordingly. Im in way over my head with this stuff.

1. Do i need the other features (i.e CSData, CSSafeCache etc etc) ?
- If so which ones for this spell and how do i configure them?
2. Should I delete the old system from Custom Script Code and keep the new one as a trigger?

This is all really confusing but I'm determined...



EDIT: Ok ive put the entire system in and now its not working at all :(
09-11-2009, 04:39 PM#12
TriggerHappy
It's horribly outdated and the new patch broke the return bug so LHV's don't work.