HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Bash and AoE

07-05-2006, 09:56 AM#1
Hemlock
I tried to give a bash (neutral hostile) an AoE damage of 200 but it does not stun all unit within 200 range of the attacking unit that has the ability

Ant reasons for that?
07-05-2006, 10:14 AM#2
aquilla
does it deal damage to all of them? I'm pretty sure it doesn't allow more than one target, so you'd have to trigger it using a war stomp dummy or something
07-05-2006, 10:22 AM#3
Jacek
It would be quite tough to make... first you need Generic Unit takes damage event and then if random integer lower than 25 then pick units in aoe and stormbolt them.

or use Unit is attacked, but I don't recommend it (permabash ftw)
07-05-2006, 10:33 AM#4
Hemlock
hmm I triggered it now but I have another question which relates to it.

I did
Trigger:
Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl

but how can I ever remove that again?
07-05-2006, 11:49 AM#5
The)TideHunter(
If you want to destroy it instantly (show birth animation then remove) then use DestroySpecialEffect(AddSpecialEffect(...))

If you want it to get rid of it after a duration (like trigger sleep action) then you have to use locals and timers, triggersleepaction + loop = loop taking 1 bit at a time, which is buggy.
07-05-2006, 11:50 AM#6
Captain Griffen
Instantly destroy it after you make it. Effect will still play.
07-05-2006, 11:58 AM#7
Hemlock
I want the effect to be gone after a period of time.

this is what it looks like when I create it

Trigger:
Unit Group - Pick every unit in (Units within 150.00 of (Position of (Attacked unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True)) and do (Actions)
Collapse Loop - Actions
Unit - Pause (Picked unit)
Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
07-05-2006, 12:19 PM#8
Pheonix-IV
Why not just use a dummy caster to cast war stomp?
07-05-2006, 12:29 PM#9
Captain Griffen
Quote:
Originally Posted by Captain Griffen
Instantly destroy it after you make it. Effect will still play.

Most special effects, if destroyed instantly, will still play through.

However, if you REALLY want to destroy a special effect after a time, then you'll need this (put it in the custom script part of the trigger editor, by clicking on the top most icon on the left, with the name of the map on):

Collapse JASS:
function H2I takes handle h returns integer
    return h
    return 0
endfunction

function I2H takes integer i returns handle
    return i
    return null
endfunction

function I2U takes integer i returns unit
    return i
    return null
endfunction

function I2E takes integer i returns effect
    return i
    return null
endfunction

function I2T takes integer i returns timer
    return i
    return null
endfunction



function DestroyEffectTimed2 takes nothing returns nothing
    local string s = I2S(H2I(GetExpiredTimer()))
    call DestroyEffect(I2E(GetStoredInteger(udg_gc, s, "effect")))
    call DestroyTimer(GetExpiredTimer())
    call FlushStoredMission(udg_gc, s)
endfunction

function DestroyEffectTimed takes effect e, real d returns nothing
    local integer it
    if e != null then
        set it = H2I(CreateTimer())
        call StoreInteger(udg_gc, I2S(it), "effect", H2I(e))
        call TimerStart(I2T(it), d, false, function DestroyEffectTimed2)
    endif
endfunction

Where gc is a global game cache (set up at start up). When ever you want to destroy a special effect after a time, do this:

Trigger:
Custom script: call DestroyEffectTimed(EFFECT, TIME)

Where:

EFFECT = the effect you want to destroy (bj_lastCreatedEffect for last created effect via GUI).
TIME = How long you want to wait before destroying it (real, in seconds, uses timer).
07-05-2006, 12:36 PM#10
The)TideHunter(
Quote:
Originally Posted by The)TideHunter(
If you want to destroy it instantly (show birth animation then remove) then use DestroySpecialEffect(AddSpecialEffect(...))

If you want it to get rid of it after a duration (like trigger sleep action) then you have to use locals and timers, triggersleepaction + loop = loop taking 1 bit at a time, which is buggy.

If you want to handle effects, in hundreds of ways and have ALOT of possabilities, use this part of my CF System:

Collapse JASS:
// Casual Functions Engine
// Created and Updated by The)TideHunter(
// Creation Began: 28/05/06
// Last Updated: 05/07/06

// Global, the gamecache is needed for CS Functions to work
globals
    gamecache udg_GC = null
endglobals

// This is the GameCache return function
function CF_GC takes nothing returns gamecache
    if(udg_GC == null) then
        call FlushGameCache(InitGameCache("GC"))
        set udg_GC = InitGameCache("GC")
    endif
    return udg_GC
endfunction

// Constants, you may edit these to fit what you want.
constant function CF_Constant_CollisionDetectionRange takes nothing returns real
    return 25. // This is the value used in functions that use a collision method.
               // When the functions collision comes in this range, the function
               // will do whats its meant to do.
endfunction

constant function CF_Constant_MinTimerUpdate takes nothing returns real
    return 0.04 // This looks convincing, and isent lag friendly.
                // Credit: Vexorian
                // This was the value I used from his Caster System.
endfunction

constant function CF_Constant_DummyUnitRawcode takes nothing returns integer
    return '????' // Dummy rawcode or your dummy.
                  // This 'MUST' be Vexorian's custom created dummy model.
                  // ~It has the correct attachment points.
endfunction

constant function CF_Constant_MorphUnitFlyAbilityRawcode takes nothing returns integer
    return '????' // Rawcode of the Morph ability in your map.
endfunction

// Variable Switches
function CF_B2I takes boolean B returns integer
    if(B) then
        return 1
    endif
    return 0
endfunction

function CF_I2B takes integer I returns boolean
    if(I == 1) then
        return true
    endif
    return false
endfunction

function CF_B2S takes boolean B returns string
    return I2S(CF_B2I(B))
endfunction

function CF_S2B takes string S returns boolean
    return CF_I2B(S2I(S))
endfunction

// Return Bug
function CF_H2I takes handle H returns integer
    return H
    return 0
endfunction
function CF_H2S takes handle H returns string
    return I2S(CF_H2I(H))
endfunction


function CF_I2Effect takes integer I returns effect
    return I
    return null
endfunction

function CF_I2Timer takes integer I returns timer
    return I
    return null
endfunction

function CF_I2Unit takes integer I returns unit
    return I
    return null
endfunction


// Attach and Store Variables
function CF_StoreInteger takes integer whichInteger, string label returns nothing
    if(whichInteger != 0) then
        call StoreInteger(CF_GC(), "Integer", label, whichInteger)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction
function CF_StoreReal takes real whichReal, string label returns nothing
    if(whichReal != 0.) then
        call StoreReal(CF_GC(), "Real", label, whichReal)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction
function CF_StoreString takes string whichString, string label returns nothing
    if(whichString != "") then
        call StoreString(CF_GC(), "String", label, whichString)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction
function CF_StoreBoolean takes boolean whichBoolean, string label returns nothing
    local integer i = CF_B2I(whichBoolean)
    if(i == 1) then
        call StoreInteger(CF_GC(), "Boolean", label, i)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction
function CF_StoreHandle takes handle whichHandle, string label, string HandleType returns nothing
    local integer i = CF_H2I(whichHandle)
    if(i != 0) then
        call StoreInteger(CF_GC(), HandleType, label, i)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction

function CF_LoadInteger takes string label returns integer
    return GetStoredInteger(CF_GC(), "Integer", label)
endfunction
function CF_LoadReal takes string label returns real
    return GetStoredReal(CF_GC(), "Real", label)
endfunction
function CF_LoadString takes string label returns string
    return GetStoredString(CF_GC(), "String", label)
endfunction
function CF_LoadBoolean takes string label returns boolean
    return CF_I2B(GetStoredInteger(CF_GC(), "Boolean", label))
endfunction

function CF_LoadUnit takes string label returns unit
    return CF_I2Unit(GetStoredInteger(CF_GC(), "Unit", label))
endfunction
function CF_LoadEffect takes string label returns effect
    return CF_I2Effect(GetStoredInteger(CF_GC(), "Effect", label))
endfunction
function CF_LoadTimer takes string label returns timer
    return CF_I2Timer(GetStoredInteger(CF_GC(), "Timer", label))
endfunction

function CF_AttachInteger takes integer whichInteger, string label, handle KeyHandle returns nothing
    local integer i = CF_H2I(KeyHandle)
    if(i != 0) then
        call StoreInteger(CF_GC(), I2S(i), label, whichInteger)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction
function CF_AttachReal takes real whichReal, string label, handle KeyHandle returns nothing
    local integer i = CF_H2I(KeyHandle)
    if(i != 0) then
        call StoreReal(CF_GC(), I2S(i), label, whichReal)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction
function CF_AttachString takes string whichString, string label, handle KeyHandle returns nothing
    local integer i = CF_H2I(KeyHandle)
    if(i != 0) then
        call StoreString(CF_GC(), I2S(i), label, whichString)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction
function CF_AttachBoolean takes boolean whichBoolean, string label, handle KeyHandle returns nothing
    local integer b = CF_B2I(whichBoolean)
    local integer i = CF_H2I(KeyHandle)
    if(i != 0) then
        call StoreInteger(CF_GC(), I2S(i), label, b)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction
function CF_AttachHandle takes handle whichHandle, string label, handle KeyHandle returns nothing
    local integer h = CF_H2I(whichHandle)
    local integer i = CF_H2I(KeyHandle)
    if(i+h != 0) then
        call StoreInteger(CF_GC(), I2S(i), label, h)
    else
        call FlushStoredMission(CF_GC(), label)
    endif
endfunction

function CF_GetAttachedInteger takes handle KeyHandle, string label returns integer
    return GetStoredInteger(CF_GC(), CF_H2S(KeyHandle), label)
endfunction
function CF_GetAttachedReal takes handle KeyHandle, string label returns real
    return GetStoredReal(CF_GC(), CF_H2S(KeyHandle), label)
endfunction
function CF_GetAttachedString takes handle KeyHandle, string label returns string
    return GetStoredString(CF_GC(), CF_H2S(KeyHandle), label)
endfunction
function CF_GetAttachedBoolean takes handle KeyHandle, string label returns boolean
    return CF_I2B(GetStoredInteger(CF_GC(), CF_H2S(KeyHandle), label))
endfunction

function CF_GetAttachedUnit takes handle KeyHandle, string label returns unit
    return CF_I2Unit(GetStoredInteger(CF_GC(), CF_H2S(KeyHandle), label))
endfunction
function CF_GetAttachedEffect takes handle KeyHandle, string label returns effect
    return CF_I2Effect(GetStoredInteger(CF_GC(), CF_H2S(KeyHandle), label))
endfunction
function CF_GetAttachedTimer takes handle KeyHandle, string label returns timer
    return CF_I2Timer(GetStoredInteger(CF_GC(), CF_H2S(KeyHandle), label))
endfunction


// Simple Functions
// Check Co-ordinates
function CF_IsXSafe takes real X returns boolean
    return (X > GetRectMinX(bj_mapInitialPlayableArea)) and (X < GetRectMaxX(bj_mapInitialPlayableArea))
endfunction

function CF_IsYSafe takes real Y returns boolean
    return (Y > GetRectMinY(bj_mapInitialPlayableArea)) and (Y < GetRectMaxY(bj_mapInitialPlayableArea))
endfunction

function CF_IsLocSafe takes real X, real Y returns boolean
    if(CF_IsXSafe(X) and CF_IsYSafe(Y)) then
        return true
    endif
    return false
endfunction

function CF_IsLocSafeEx takes location whichLocation returns boolean
    return CF_IsLocSafe(GetLocationX(whichLocation), GetLocationY(whichLocation))
endfunction

// Remove Attachments
function CF_RemoveAttachments takes handle KeyHandle returns nothing
    call FlushStoredMission(CF_GC(), CF_H2S(KeyHandle))
endfunction

function CF_RemoveStoredData takes string label returns nothing
    call FlushStoredMission(CF_GC(), label)
endfunction

// Remove Handles
function CF_DestroyTimer takes timer whichTimer returns nothing
    call PauseTimer(whichTimer)
    call CF_RemoveAttachments(whichTimer)
    call DestroyTimer(whichTimer)
endfunction

function CF_RemoveUnit takes unit whichUnit returns nothing
    call CF_RemoveAttachments(whichUnit)
    call RemoveUnit(whichUnit)
endfunction

function CF_DestroyEffect takes effect whichEffect returns nothing
    local unit CarryingUnit = CF_GetAttachedUnit(whichEffect, "Effect_CarryingUnit")
    call CF_RemoveAttachments(whichEffect)
    call DestroyEffect(whichEffect)
    call CF_RemoveAttachments(CarryingUnit)
    call RemoveUnit(CarryingUnit)
    set CarryingUnit = null
endfunction

// Get a Dummy Unit, ready for anything
function CF_GetADummy takes real X, real Y returns unit
    local unit u
    if(CF_IsLocSafe(X, Y)) then
        set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), CF_Constant_DummyUnitRawcode(), X, Y, 90.)
        call UnitAddAbility(u, CF_Constant_MorphUnitFlyAbilityRawcode())
        call UnitRemoveAbility(u, CF_Constant_MorphUnitFlyAbilityRawcode())
        call UnitAddAbility(u, 'Avul')
        call UnitAddAbility(u, 'Aloc')
        call SetUnitMoveSpeed(u, 522)
    endif
    return u
endfunction

// Hide or Show a unit for a player
function CF_ShowUnitForPlayer takes unit whichUnit, player whichPlayer returns nothing
    if(GetLocalPlayer() == whichPlayer) then
        call ShowUnit(whichUnit, true)
    endif
endfunction

function CF_HideUnitForPlayer takes unit whichUnit, player whichPlayer returns nothing
    if(GetLocalPlayer() == whichPlayer) then
        call ShowUnit(whichUnit, false)
    endif
endfunction

function CF_UnitDisplayForPlayer takes unit whichUnit, player whichPlayer, boolean show returns nothing
    if(GetLocalPlayer() == whichPlayer) then
        call ShowUnit(whichUnit, show)
    endif
endfunction     

// Special Functions:-
//                    Consists of things that the standard W/E dosent not let you do.
//

// Effect
function CF_CreateGroundEffect takes real X, real Y, real Z, real facing, real sizeFactor, string modelPath, integer red, integer green, integer blue, integer alpha returns effect
    local effect NewEffect
    local unit CarryingUnit
    if(CF_IsLocSafe(X, Y)) then
        set CarryingUnit = CF_GetADummy(X, Y)
        set NewEffect = AddSpecialEffectTarget(modelPath, CarryingUnit, "origin")
        call SetUnitFlyHeight(CarryingUnit, Z, 0.)
        call SetUnitFacing(CarryingUnit, facing)
        call SetUnitScalePercent(CarryingUnit, sizeFactor, sizeFactor, sizeFactor) // This uses scaling factor.
                                                                                   // 1. would be the same size.
                                                                                   // 1.1 would be 10% bigger than
                                                                                   // usual.
                                                                                   // 2. would be 100% bigger than
                                                                                   // usual.
        call SetUnitVertexColor(CarryingUnit, red, green, blue, alpha)
        call CF_AttachHandle(CarryingUnit, "Effect_CarryingUnit", NewEffect)
        call CF_AttachReal(X, "Effect_XCoord", NewEffect)
        call CF_AttachReal(Y, "Effect_YCoord", NewEffect)
        call CF_AttachReal(Z, "Effect_ZCoord", NewEffect)
        call CF_AttachReal(facing, "Effect_FacingDegrees", NewEffect)
        call CF_AttachReal(sizeFactor, "Effect_Size", NewEffect)
        call CF_AttachInteger(red, "Effect_RedColour", NewEffect)
        call CF_AttachInteger(green, "Effect_GreenColour", NewEffect)
        call CF_AttachInteger(blue, "Effect_BlueColour", NewEffect)
        call CF_AttachInteger(alpha, "Effect_AlphaColour", NewEffect)
        call CF_AttachString(modelPath, "Effect_ModelPath", NewEffect)
        call CF_StoreHandle(NewEffect, "CF_MEMORY_LASTCREATED_EFFECT", "Effect")
        return NewEffect
    endif
    set NewEffect = null
    set CarryingUnit = null
    return null
endfunction

function CF_GetLastCreatedEffect takes nothing returns effect
    return CF_LoadEffect("CF_MEMORY_LASTCREATED_EFFECT")
endfunction

function CF_GetEffectCarryingUnit takes effect whichEffect returns unit
    return CF_GetAttachedUnit(whichEffect, "Effect_CarryingUnit")
endfunction

function CF_GetEffectX takes effect whichEffect returns real
    return CF_GetAttachedReal(whichEffect, "Effect_XCoord")
endfunction

function CF_GetEffectY takes effect whichEffect returns real
    return CF_GetAttachedReal(whichEffect, "Effect_YCoord")
endfunction

function CF_GetEffectZ takes effect whichEffect returns real
    return CF_GetAttachedReal(whichEffect, "Effect_ZCoord")
endfunction

function CF_GetEffectFacing takes effect whichEffect returns real
    return CF_GetAttachedReal(whichEffect, "Effect_FacingDegrees")
endfunction

function CF_GetEffectSize takes effect whichEffect returns real
    return CF_GetAttachedReal(whichEffect, "Effect_Size")
endfunction

function CF_GetEffectModelPath takes effect whichEffect returns string
    return CF_GetAttachedString(whichEffect, "Effect_ModelPath")
endfunction

function CF_GetEffectRedColour takes effect whichEffect returns integer
    return CF_GetAttachedInteger(whichEffect, "Effect_RedColour")
endfunction

function CF_GetEffectGreenColour takes effect whichEffect returns integer
    return CF_GetAttachedInteger(whichEffect, "Effect_GreenColour")
endfunction

function CF_GetEffectBlueColour takes effect whichEffect returns integer
    return CF_GetAttachedInteger(whichEffect, "Effect_BlueColour")
endfunction

function CF_GetEffectAlphaColour takes effect whichEffect returns integer
    return CF_GetAttachedInteger(whichEffect, "Effect_AlphaColour")
endfunction

function CF_IsEffectLocked takes effect whichEffect returns boolean
    if(CF_GetAttachedBoolean(whichEffect, "Effect_Locked")) then
        return true
    endif
    return false
endfunction

function CF_IsEffectInRect takes effect whichEffect, real minX, real minY, real maxX, real maxY returns boolean
    local real X = CF_GetEffectX(whichEffect)
    local real Y = CF_GetEffectY(whichEffect)
    if(X > minX) and (X < maxX) and (Y > minY) and (Y < maxY) then
        return true
    endif
    return false
endfunction

function CF_IsEffectInRectEx takes effect whichEffect, rect whichRect returns boolean
    local real X
    local real Y
    if(X > GetRectMinX(whichRect)) and (X < GetRectMaxX(whichRect)) and (Y > GetRectMinY(whichRect)) and (Y < GetRectMaxY(whichRect)) then
        return true
    endif
    return false
endfunction

function CF_IsEffectInRange takes effect whichEffect, real X, real Y, real radius returns boolean
    return IsUnitInRangeXY(CF_GetEffectCarryingUnit(whichEffect), X, Y, radius)
endfunction

function CF_IsEffectInRangeEx takes effect whichEffect, location whichLocation, real radius returns boolean
    return IsUnitInRangeXY(CF_GetEffectCarryingUnit(whichEffect), GetLocationX(whichLocation), GetLocationY(whichLocation), radius)
endfunction 

function CF_SetEffectX takes effect whichEffect, real X returns nothing
    if(CF_IsXSafe(X) and (CF_IsEffectLocked(whichEffect) == false)) then
        call SetUnitX(CF_GetEffectCarryingUnit(whichEffect), X)
        call CF_AttachReal(X, "Effect_XCoord", whichEffect)
    endif
endfunction

function CF_SetEffectY takes effect whichEffect, real Y returns nothing
    if(CF_IsYSafe(Y) and (CF_IsEffectLocked(whichEffect) == false)) then
        call SetUnitY(CF_GetEffectCarryingUnit(whichEffect), Y)
        call CF_AttachReal(Y, "Effect_YCoord", whichEffect)
    endif
endfunction

function CF_SetEffectLoc takes effect whichEffect, real X, real Y returns nothing
    local unit CarryingUnit = CF_GetEffectCarryingUnit(whichEffect)
    if(CF_IsLocSafe(X, Y) and (CF_IsEffectLocked(whichEffect) == false)) then
        call SetUnitX(CarryingUnit, X)
        call SetUnitY(CarryingUnit, Y)
        call CF_AttachReal(X, "Effect_XCoord", whichEffect)
        call CF_AttachReal(Y, "Effect_YCoord", whichEffect)
    endif
    set CarryingUnit = null
endfunction

function CF_SetEffectLocEx takes effect whichEffect, location whichLocation returns nothing
    call CF_SetEffectLoc(whichEffect, GetLocationX(whichLocation), GetLocationY(whichLocation))
endfunction

function CF_SetEffectZ takes effect whichEffect, real newZ returns nothing
    if(CF_IsEffectLocked(whichEffect) == false) then
        call SetUnitFlyHeight(CF_GetEffectCarryingUnit(whichEffect), newZ, 0.)
        call CF_AttachReal(newZ, "Effect_ZCoord", whichEffect)
    endif
endfunction

function CF_SetEffectFacing takes effect whichEffect, real facing returns nothing
    if(CF_IsEffectLocked(whichEffect) == false) then
        call SetUnitFacing(CF_GetEffectCarryingUnit(whichEffect), facing)
        call CF_AttachReal(facing, "Effect_FacingDegrees", whichEffect)
    endif
endfunction

function CF_SetEffectSize takes effect whichEffect, real sizeFactor returns nothing
    local real oldFactor = CF_GetEffectSize(whichEffect)
    if(CF_IsEffectLocked(whichEffect) == false) then
        call SetUnitScalePercent(CF_GetEffectCarryingUnit(whichEffect), sizeFactor, sizeFactor, sizeFactor)
        call CF_AttachReal(oldFactor + sizeFactor - 1., "Effect_Size", whichEffect)
    endif
endfunction

function CF_EffectAddExpirationTime_Destroy takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local effect e = CF_GetAttachedEffect(t, "Timer_Expiration_Effect")
    call CF_DestroyTimer(t)
    call CF_DestroyEffect(e)
    set t = null
    set e = null
endfunction

function CF_EffectAddExpirationTime takes effect whichEffect, real time returns nothing
    local timer t = CreateTimer()
    if(CF_IsEffectLocked(whichEffect) == false) then
        call CF_AttachHandle(whichEffect, "Timer_Expiration_Effect", t)
        call TimerStart(t, time, false, function CF_EffectAddExpirationTime_Destroy)
    endif
endfunction

function CF_SetEffectColour takes effect whichEffect, integer red, integer green, integer blue, integer alpha returns nothing
    if(CF_IsEffectLocked(whichEffect) == false) then
        call SetUnitVertexColor(CF_GetEffectCarryingUnit(whichEffect), red, green, blue, alpha)
    endif
endfunction

function CF_SetEffectRedColour takes effect whichEffect, integer red returns nothing
    local integer green = CF_GetEffectGreenColour(whichEffect)
    local integer blue = CF_GetEffectBlueColour(whichEffect)
    local integer alpha = CF_GetEffectAlphaColour(whichEffect)
    if(CF_IsEffectLocked(whichEffect) == false) then
        call SetUnitVertexColor(CF_GetEffectCarryingUnit(whichEffect), red, green, blue, alpha)
    endif
endfunction

function CF_SetEffectGreenColour takes effect whichEffect, integer green returns nothing
    local integer red = CF_GetEffectRedColour(whichEffect)
    local integer blue = CF_GetEffectBlueColour(whichEffect)
    local integer alpha = CF_GetEffectAlphaColour(whichEffect)
    if(CF_IsEffectLocked(whichEffect) == false) then
        call SetUnitVertexColor(CF_GetEffectCarryingUnit(whichEffect), red, green, blue, alpha)
    endif
endfunction

function CF_SetEffectBlueColour takes effect whichEffect, integer blue returns nothing
    local integer red = CF_GetEffectRedColour(whichEffect)
    local integer green = CF_GetEffectGreenColour(whichEffect)
    local integer alpha = CF_GetEffectAlphaColour(whichEffect)
    if(CF_IsEffectLocked(whichEffect) == false) then
        call SetUnitVertexColor(CF_GetEffectCarryingUnit(whichEffect), red, green, blue, alpha)
    endif
endfunction

function CF_SetEffectAlphaColour takes effect whichEffect, integer alpha returns nothing
    local integer red = CF_GetEffectRedColour(whichEffect)
    local integer green = CF_GetEffectGreenColour(whichEffect)
    local integer blue = CF_GetEffectBlueColour(whichEffect)
    if(CF_IsEffectLocked(whichEffect) == false) then
        call SetUnitVertexColor(CF_GetEffectCarryingUnit(whichEffect), red, green, blue, alpha)
    endif
endfunction

function CF_CopyEffect takes effect whichEffect returns effect
    return CF_CreateGroundEffect(CF_GetEffectX(whichEffect), CF_GetEffectY(whichEffect), CF_GetEffectZ(whichEffect), CF_GetEffectFacing(whichEffect), CF_GetEffectSize(whichEffect), CF_GetEffectModelPath(whichEffect), CF_GetEffectRedColour(whichEffect), CF_GetEffectGreenColour(whichEffect), CF_GetEffectBlueColour(whichEffect), CF_GetEffectAlphaColour(whichEffect))
endfunction

function CF_CopyEffectLoc takes effect whichEffect, real X, real Y returns effect
    local effect e = CF_CopyEffect(whichEffect)
    local integer Ie = CF_H2I(e)
    call CF_SetEffectLoc(e, X, Y)
    set e = null
    return Ie
    return null
endfunction

function CF_CopyEffectLocEx takes effect whichEffect, location whichLocation returns effect
    return CF_CopyEffectLoc(whichEffect, GetLocationX(whichLocation), GetLocationY(whichLocation))
endfunction

function CF_LockEffect takes effect whichEffect returns nothing
    call CF_AttachBoolean(true, "Effect_Locked", whichEffect) // If a effect is locked, nothing can be changed,
                                                              // Only things like copy and getting values is
                                                              // possible.
endfunction

function CF_UnlockEffect takes effect whichEffect returns nothing
    call CF_AttachBoolean(false, "Effect_Locked", whichEffect) // Allows the effect to be changed again
endfunction

function CF_LockEffectEdit takes effect whichEffect, boolean lock returns nothing
    call CF_AttachBoolean(lock, "Effect_Locked", whichEffect)
endfunction

function CF_ShowEffectForPlayer takes effect whichEffect, player whichPlayer returns nothing
    if(GetLocalPlayer() == whichPlayer) then
        call ShowUnit(CF_GetEffectCarryingUnit(whichEffect), true)
    endif
endfunction

function CF_HideEffectForPlayer takes effect whichEffect, player whichPlayer returns nothing
    if(GetLocalPlayer() == whichPlayer) then
        call ShowUnit(CF_GetEffectCarryingUnit(whichEffect), false)
    endif
endfunction

function CF_DisplayEffectForPlayer takes effect whichEffect, player whichPlayer, boolean show returns nothing
    if(GetLocalPlayer() == whichPlayer) then
        call ShowUnit(CF_GetEffectCarryingUnit(whichEffect), show)
    endif
endfunction

EDIT: Note: this system is still under construction, some things may or may not work. They might not be as offiecent as they should be either.
EDIT2: Btw, dont create a effect using the normal GUI or Jass function.
For the other functions to work you MUST use the:
Collapse JASS:
function CF_CreateGroundEffect takes real X, real Y, real Z, real facing, real sizeFactor, string modelPath, integer red, integer green, integer blue, integer alpha returns effect
07-05-2006, 01:42 PM#11
Hemlock
Well I managed to get it done Pheonix-IV way, thanks for the suggestion.

But now I have another problem, I create the dummy unit at the place of the damaged unit, and let him cast the ability, but the problem now, is that it creates more dummy units cause the tower has splash damage.