HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Damage

05-09-2008, 07:03 PM#1
zetanno
For my map I'm trying to create a shield that absorbs the damage taken but there is a problem : I use Unit x takes damage event , an integer to set the damage taken and if the shield is greater than the damage taken the shield points are decreased and the life is set to normal value .If the shield is lower than the damage i use another integer to set the difference and then the units life is decreased by that amount . Now the problem : for the first attack of a unit the life isn't set to the normal value and it is decreased as well as the shield . For other attacks it work . So if the attack is powerful than unit's life that unit will be killed .
Can somebody help me with this ?
05-10-2008, 03:24 AM#2
Pyrogasm
Post the trigger; I don't understand your post very well.
05-10-2008, 07:34 AM#3
zetanno
I don't know how to post a trigger but I'll write it :
Event - Unit x takes damage.
Actions - Set Damage = Damage Taken
- Set life of unit x equal to life of unit x + damage.
If Shield greater than Damage :
- Set Shield = Shield - Damage
If Shield lower than Damage :
- Set Shield = 0
- Set Difference = Damage - Shield
- Cause Damage Source to Damage triggering unit dealing Difference damage ...

And that's all.
05-10-2008, 07:41 AM#4
Pheonix-IV
He needs a damage detection system.

WELCOME TO ONE OF THE MOST RETARDED AREAS OF WCIII TRIGGERING.

Enjoy your stay.
05-10-2008, 09:20 AM#5
zetanno
Now I've found something interesting : a shield spell that absorbs damage has regeneration and it can be made indestructible ...
Custom Map Script
Collapse JASS:
//================
function H2I takes handle h returns integer
    return h
    return 0
endfunction
 
// ===========================
function LocalVars takes nothing returns gamecache
    return udg_hash
endfunction
 
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
    endif
endfunction
 
function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
         call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
    if value==false then
        call FlushStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, true )
    endif
endfunction

function GetHandleBoolean takes handle subject, string name returns boolean
    return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
 
function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns  effect
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTextTag takes handle subject, string name returns  texttag
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTriggerAction takes handle subject, string name returns triggeraction
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
 
function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction


// Shield System
// By Shadow1500
// HandleVars by KaTTaNa

// configuration


constant function BarColor takes nothing returns string
    return "|cFF8000FF"
endfunction
constant function BarChar takes nothing returns string
    return "'"
endfunction
constant function BarLength takes nothing returns integer
    return 20
endfunction
constant function BarSize takes nothing returns real
    return 12.50
endfunction
constant function BarOffset takes nothing returns real
    return -32.00
endfunction
constant function BarOffsetY takes nothing returns real
    return -42.00
endfunction
constant function DeadFixerAbility takes nothing returns integer
    return 'A004'
endfunction
constant function AllowDamageSpill takes nothing returns boolean
    return true
endfunction //if true then when the shield breaks it will only block some of the damage done depending on its HP
// end configuration


function DamageModify_Child takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = GetHandleUnit(t,"u")

    if GetHandleBoolean(t,"fix") then
        call UnitRemoveAbility( u, DeadFixerAbility() )
    endif
    call SetUnitState(u ,UNIT_STATE_LIFE, GetHandleReal(t,"finalhp") )

    set u = null
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    set t = null
endfunction

// This function will "block" a certain amount of damage done to the unit
// Needs to be used in the EVENT_UNIT_DAMAGED event.
function DamageModify takes unit whichUnit, real dmg, real dmgnew returns nothing
    local timer t = CreateTimer()
    local real life = GetUnitState(whichUnit, UNIT_STATE_LIFE)
    local real maxlife = GetUnitState(whichUnit, UNIT_STATE_MAX_LIFE)
    local boolean usetimer = false
    local real dmgback = dmg-dmgnew
    local real finalhp = life-dmgnew
    if dmgnew>dmg then
        return
    endif
    if dmg > maxlife then
        call UnitAddAbility( whichUnit,DeadFixerAbility())
        call SetHandleBoolean(t, "fix", true)
        set maxlife = 1000+maxlife
        set usetimer = true
    endif
    if ( life+dmgback > maxlife ) then
        call SetUnitState(whichUnit ,UNIT_STATE_LIFE, maxlife )
        set usetimer = true
    else
        call SetUnitState(whichUnit ,UNIT_STATE_LIFE, life+dmgback )
    endif
    if usetimer then
        call SetHandleHandle(t,"u",whichUnit)
        call SetHandleReal(t,"finalhp",finalhp)
        call TimerStart(t, 0, false, function DamageModify_Child)
    else
        call DestroyTimer(t)
    endif
    set t = null
endfunction

function UpdateBar takes unit whichUnit returns nothing
    local string bar = GetHandleString(whichUnit,"scolor")
    local integer y = 0
    local real slife = GetHandleReal(whichUnit,"slife")
    local real maxslife = GetHandleReal(whichUnit,"maxslife")
    local boolean endc = false

    loop
        exitwhen y==BarLength()
        if (not endc) and (slife < (y * (maxslife/BarLength()))+1) then
            set endc = true
            set bar = bar+"|r|cFF000000"
        else
            set bar = bar+BarChar()
        endif
        set y = y + 1
    endloop
    set bar = bar+"|r"
    call SetTextTagTextBJ(GetHandleTextTag(whichUnit,"lifebar"),bar,BarSize())
endfunction
function DestroyShield takes unit whichUnit returns nothing
    local texttag tag = GetHandleTextTag(whichUnit,"lifebar")
    local trigger trig = GetHandleTrigger(whichUnit,"shielddmg")
    local timer t = GetHandleTimer(whichUnit,"shieldtimer")
    call SetHandleBoolean(whichUnit,"sd",false)
    
    // destroy shield
    call UnitRemoveAbility(whichUnit,GetHandleInt(t,"buff"))
    call SetHandleReal(whichUnit,"slife",0)
    call SetHandleReal(whichUnit,"maxslife",0)
    call SetHandleReal(whichUnit,"reg",0)
    call SetHandleReal(whichUnit,"sarmor",0)
    call SetHandleString(whichUnit,"scolor",null)
    
    // destroy tag
    call DestroyTextTag(tag)
    call SetHandleHandle( whichUnit, "lifebar", null )
    set tag = null
    
    // destoy trigger
    call SetHandleHandle(whichUnit,"shielddmg",null)
    call TriggerRemoveAction(trig,GetHandleTriggerAction(trig,"action"))
    call FlushHandleLocals(trig)
    call DestroyTrigger(trig)
    set trig = null
    
    // destroy timer
    call SetHandleHandle(whichUnit,"shieldtimer",null)
    call PauseTimer(t)
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    set t = null
endfunction
function ShieldDamage takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real dmg = GetEventDamage()
    local real slife = GetHandleReal(u,"slife")
    local real take = 1-GetHandleReal(u,"sarmor")
    if GetTriggerEventId() == EVENT_UNIT_DEATH then
        call DestroyShield(u)
        set u = null
        return
    endif
    if (slife<(dmg*take)) then
        if GetHandleBoolean(u,"sd") then
            call DestroyShield(u)
        else
            call SetHandleReal(u,"slife",0)
        endif
        if AllowDamageSpill() then
            call DamageModify(u,dmg,dmg-(slife*(1/take))) // use the remaining power of the shield to block some of the damage
        else
            call DamageModify(u,dmg,0)
        endif
    else
        call DamageModify(u,dmg,0) // block all damage
        call SetHandleReal(u,"slife",slife-(dmg*take))
        call UpdateBar(u)
    endif
    set u = null
endfunction
function CreateShield_Child takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit whichUnit = GetHandleUnit(t,"u")
    local texttag tag = GetHandleTextTag(whichUnit,"lifebar")
    local real x = GetUnitX(whichUnit)+BarOffset()
    local real y = GetUnitY(whichUnit)+BarOffsetY()
    local integer pulse = GetHandleInt(t,"pulse")
    local real upcheck = GetHandleReal(t,"check")
    local real reg = GetHandleReal(whichUnit,"reg")
    local real slife = GetHandleReal(whichUnit,"slife")
    local real maxslife = GetHandleReal(whichUnit,"maxslife")
    local integer buffId = GetHandleInt(t,"buff")
    if (GetHandleBoolean(whichUnit,"sd") and pulse==0) or ((GetUnitAbilityLevel(whichUnit,buffId)==0) and buffId!=0) then
        call DestroyShield(whichUnit)
        set t = null
        return
    endif
    
    if reg!=0 then
       if (slife+reg)>=maxslife then
           call SetHandleReal(whichUnit,"slife",maxslife)
       else
           call SetHandleReal(whichUnit,"slife",slife+reg)
       endif
       call UpdateBar(whichUnit)
    elseif upcheck!=GetHandleReal(whichUnit,"slife") then
        call SetHandleReal(t,"check",GetHandleReal(whichUnit,"slife"))
        call UpdateBar(whichUnit)
    endif
    
    // countdown on how many times did timer ran
    if pulse>0 then
        call SetHandleInt(t,"pulse",pulse-1)
    endif
    
    call SetTextTagPos(tag,x,y,140)
    call SetTextTagVisibility(tag,IsUnitVisible(whichUnit,GetLocalPlayer()))

    set whichUnit = null
    set tag = null
    set t = null
endfunction
function CreateShieldEx takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor, string color, boolean dmgspill returns nothing
    // duration of -1 = shield remains on unit when depleted
    // duration of 0 = shield stays on unit until depleted
    // duration of 1 or higher = shield stays until depleted or until duration ends
    // buffId is optional
    // regenerate is the amount of points regenerated every second
    // armor must be between 0 and 1, with 1 making the shield take no damage
    // color must in blizzard's color code format
    // when dmgspill is off the shield will block all damage when depleted
    local texttag tag = GetHandleTextTag( target, "lifebar")
    local trigger whenDamaged = GetHandleTrigger(target,"shielddmg")
    local timer t = GetHandleTimer(target,"shieldtimer")
    local boolean useOld = false    
    local real x = GetUnitX(target)+BarOffset()
    local real y = GetUnitY(target)+BarOffsetY()

    if GetHandleReal(target,"slife")!=0 then
        if GetHandleInt(t,"buff")!=buffId then
            call UnitRemoveAbility(target,GetHandleInt(t,"buff"))
        endif
        call PauseTimer(t)
        call SetHandleReal(target,"reg",0)
        call SetHandleReal(target,"sarmor",0)
        call SetHandleString( target, "scolor", null)
        call DestroyTextTag(tag)
        set useOld = true
    else
        set t = CreateTimer()
        set whenDamaged = CreateTrigger()
    endif
    set tag = CreateTextTag()
    call SetHandleReal( target, "slife", shieldhp)
    call SetHandleReal( target, "maxslife", shieldhp)
    
    call SetHandleString( target, "scolor", color)
    
    // take care of the texttag
    call SetTextTagTextBJ(tag,"tag",BarSize())
    call SetTextTagPos(tag,x,y,140)
    call SetTextTagPermanent(tag,true)
    call SetTextTagColor(tag,255,255,255,255)
    call SetTextTagVisibility(tag,IsUnitVisible(target,GetLocalPlayer()))
    call SetHandleHandle( target, "lifebar", tag )
    call UpdateBar(target)
    
    // take care of the trigger
    if not useOld then
        call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DAMAGED)
        call TriggerRegisterUnitEvent(whenDamaged,target,EVENT_UNIT_DEATH)
        call SetHandleHandle(whenDamaged,"action",TriggerAddAction(whenDamaged,function ShieldDamage))
        call SetHandleHandle(target,"shielddmg",whenDamaged)
    endif
    call SetHandleBoolean( whenDamaged, "dmgspill", dmgspill)

    // take care of the timer
    call SetHandleHandle( target, "shieldtimer", t)
    call SetHandleHandle( t,"u",target)
    call SetHandleReal( t, "check", shieldhp)
    if regenerate!=0 then
        call SetHandleReal(target,"reg",(regenerate)/(1/0.04))
    endif
    if armor!=0 then
        call SetHandleReal(target,"sarmor",armor)
    endif
    call SetHandleInt(t,"pulse",-1)
    if duration>=0 then
        call SetHandleBoolean( target, "sd", true)
        if duration>0 then
            call SetHandleInt(t,"pulse",R2I(duration/0.04)) 
        endif
    endif
    call SetHandleInt(t,"buff",buffId)
    
    call TimerStart(t,0.04,true,function CreateShield_Child)

    set whenDamaged = null
    set t = null
    set tag = null
endfunction
function CreateShield takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor returns nothing
    call CreateShieldEx( target, shieldhp, duration, buffId, regenerate, armor, BarColor(), AllowDamageSpill())
endfunction
function CreateShieldSimple takes unit target, real shieldhp, real duration, integer buffId returns nothing
    call CreateShieldEx( target, shieldhp, duration, buffId, 0, 0, BarColor(), AllowDamageSpill())
endfunction
This one is god but I don't know how to destroy the shield or how to detect its current life and the big problem : if unit dies shield goes bye bye. Now is WoW Molten Core I've found the same system but in an advanced form that can be destroyed and has the die bug repaired . The problem is that I don't know how to use that one.
Molten Core Custom Map Script
Collapse JASS:
//================
function H2I takes handle h returns integer
    return h
    return 0
endfunction
 
// ===========================
function LocalVars takes nothing returns gamecache
    return udg_hash
endfunction
 
function SetHandleHandle takes handle subject, string name, handle value returns nothing
    if value==null then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
        call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
    endif
endfunction
 
function SetHandleInt takes handle subject, string name, integer value returns nothing
    if value==0 then
        call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
    else
         call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleReal takes handle subject, string name, real value returns nothing
    if value==0 then
        call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function SetHandleString takes handle subject, string name, string value returns nothing
    if value==null then
        call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
    else
        call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
    endif
endfunction
 
function GetHandleHandle takes handle subject, string name returns handle
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
    return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
    return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
 
function GetHandleUnit takes handle subject, string name returns unit
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleEffect takes handle subject, string name returns  effect
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
function GetHandleTextTag takes handle subject, string name returns  texttag
    return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
    return null
endfunction
 
function FlushHandleLocals takes handle subject returns nothing
    call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
As u can see this one is shorter.
Shield Damage
Collapse JASS:
function GetShieldBuff takes nothing returns integer
    return 'B00Y'
endfunction
function GetShieldDeadFixer takes nothing returns integer
    return 'A02X'
endfunction
//====================================================
function Trig_Shield_Damage_Actions_Child takes nothing returns nothing
    local timer x = GetExpiredTimer()
    local real special = GetHandleReal( x, "special" )
    local unit ouch = GetHandleUnit( x, "unit" )
    local real dmg = GetHandleReal( x, "dmg" )
    if special < 0.00 then
        call SetUnitLifeBJ( ouch, ( GetUnitStateSwap(UNIT_STATE_LIFE, ouch) + dmg ) )
        set special = RAbsBJ(special)
        call SetUnitLifeBJ( ouch, ( GetUnitStateSwap(UNIT_STATE_LIFE, ouch) - special ) )
        set special = 0.00
        call UnitRemoveBuffBJ( GetShieldBuff(), ouch )
        call SetHandleReal( GetTriggerUnit(), "shieldmax", 0.00)
        set udg_retrive = GetHandleTextTag( ouch, "float" )
        call SetHandleHandle( ouch, "float", null)
        call DestroyTextTagBJ( udg_retrive )
    else
        call SetUnitLifeBJ( ouch, ( GetUnitStateSwap(UNIT_STATE_LIFE, ouch) + dmg ) )
    endif
    call UnitRemoveAbilityBJ( GetShieldDeadFixer(), ouch )
    call SetHandleReal( ouch, "shield", special )
    set x = null
endfunction

function Trig_Shield_Damage_Actions takes nothing returns nothing
    local timer x = CreateTimer()
    local real special = GetHandleReal(  GetTriggerUnit(), "shield" )
    local effect fx
    call UnitAddAbilityBJ( GetShieldDeadFixer(), GetTriggerUnit() )
    if GetEventDamage() == 0 then
        call UnitRemoveAbilityBJ( GetShieldDeadFixer(), GetTriggerUnit() )
        set x = null
        return
    endif
    if special == 0 then
        call UnitRemoveAbilityBJ( GetShieldDeadFixer(), GetTriggerUnit())
        set x = null
        return
    endif
    if UnitHasBuffBJ(GetTriggerUnit(), GetShieldBuff()) == false then
        call SetHandleReal( GetTriggerUnit(), "shieldmax", 0.00)
        set udg_retrive = GetHandleTextTag( GetTriggerUnit(), "float" )
        call SetHandleHandle( GetTriggerUnit(), "float", null)
        call DestroyTextTagBJ( udg_retrive )
        call UnitRemoveAbilityBJ( GetShieldDeadFixer(), GetTriggerUnit() )
        set x = null
        return
    endif
    set fx = AddSpecialEffectTargetUnitBJ( "origin", GetTriggerUnit(), "Abilities\\Spells\\Human\\Defend\\DefendCaster.mdl" )
    call DestroyEffectBJ( fx )
    set special = special - GetEventDamage()
    call SetHandleHandle( x, "unit", GetTriggerUnit() )
    call SetHandleReal( x, "special", special )
    call SetHandleReal( x, "dmg", GetEventDamage() )
    call TimerStart(x, 0.01, false, function Trig_Shield_Damage_Actions_Child)
    set x = null
endfunction

//===========================================================================
function InitTrig_Shield_Damage takes nothing returns nothing
    set gg_trg_Shield_Damage = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Shield_Damage, function Trig_Shield_Damage_Actions )
endfunction
//==========================================================================
This wasn't is the original map.
Cast Spell x
Collapse JASS:
function Trig_Cast_PWS_Func001C takes nothing returns boolean
    if ( ( GetSpellAbilityId() == 'A01F' ) ) then
        return true
    endif
    if ( ( GetSpellAbilityId() == 'A04L' ) ) then
        return true
    endif
    return false
endfunction

function Trig_Cast_PWS_Conditions takes nothing returns boolean
    if ( not Trig_Cast_PWS_Func001C() ) then
        return false
    endif
    return true
endfunction

function Trig_Cast_PWS_Actions takes nothing returns nothing
    local texttag retrive
    local unit udg_TempUnit = GetSpellTargetUnit()
    if GetHandleInt( GetSpellTargetUnit(), "wasshielded" ) == 0 then
    call SetHandleInt(GetSpellTargetUnit(), "wasshielded", 1)
    call TriggerRegisterUnitEvent( gg_trg_Shield_Damage, GetSpellTargetUnit(), EVENT_UNIT_DAMAGED )
    endif
    set udg_ShieldLife = ( 200.00 + ( I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) * 150.00 ) )
    call SetHandleReal( GetSpellTargetUnit(), "shield", udg_ShieldLife)
    call SetHandleReal( GetSpellTargetUnit(), "shieldmax", udg_ShieldLife)
    call CreateTextTagUnitBJ( "TRIGSTR_1219", GetSpellTargetUnit(), 0, 12.00, 100, 100, 100, 0 )
    set retrive = GetLastCreatedTextTag()
    call SetHandleHandle( GetSpellTargetUnit(), "float", GetLastCreatedTextTag() )
    call SetHandleInt( GetSpellTargetUnit(), "ws", 1 )
    call TriggerSleepAction( 30.00 )
    call SetHandleInt( udg_TempUnit, "ws", 0 )
    call DestroyTextTagBJ( retrive )
    call SetHandleReal( udg_TempUnit, "shield", 0.00)
    call SetHandleReal( udg_TempUnit, "shieldmax", 0.00)
    call SetHandleHandle( udg_TempUnit, "float", null)
endfunction

//===========================================================================
function InitTrig_Cast_PWS takes nothing returns nothing
    set gg_trg_Cast_PWS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Cast_PWS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Cast_PWS, Condition( function Trig_Cast_PWS_Conditions ) )
    call TriggerAddAction( gg_trg_Cast_PWS, function Trig_Cast_PWS_Actions )
endfunction

Now the one with the bug
Flush dead units
Collapse JASS:
function Trig_Flush_dead_units_Actions takes nothing returns nothing
    call SetHandleInt( GetDyingUnit(), "wasshielded", 0)
    call SetHandleReal( GetDyingUnit(), "shield", 0.00)
    call SetHandleReal( GetDyingUnit(), "shieldmax", 0.00)
    set udg_retrive = GetHandleTextTag( GetDyingUnit(), "float" )
    call SetHandleHandle( GetDyingUnit(), "float", null)
    call DestroyTextTag( udg_retrive )
    call SetHandleInt( GetDyingUnit(), "ws", 0 )
endfunction

//===========================================================================
function InitTrig_Flush_dead_units takes nothing returns nothing
    set gg_trg_Flush_dead_units = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Flush_dead_units, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Flush_dead_units, function Trig_Flush_dead_units_Actions )
endfunction
And thats all . Is there anybody that can help me with this shield system ?
05-11-2008, 06:12 AM#6
Pyrogasm
There's a bug with Shadow1500's system that needs fixing? Can you describe it in more detail?
05-11-2008, 08:01 AM#7
zetanno
Hmm not the bug is the problem . The problem is that I can't detect the current life of the shield and also I don't know how to destroy the shield . Now ,I'm trying new ideas of shields ..