Adding ''sight dummy''

Crusher

You can change this now in User CP.
Reaction score
121
So, I basically need to add some sort of vision on these spells once they're casted.

First spells is a line target spell, something like shockwaye:

JASS:
scope EnchantedSpear initializer Init
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// CONFIGURABLE GLOBALS
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    globals
        private constant integer SPELL_ID = 'A05Z'
        private constant real TIMER_INTERVAL = 0.04
        
        private constant real SPEED = 900.
        private constant real DISTANCE_TO_CASTER = 120.
        private constant real ROTATE_SPEED = 10.
        private constant real MODEL_HEIGHT = 105
        private constant real AOE = 95.
        private constant integer AMOUNT = 3
    
        private constant attacktype ATK_TYPE = ATTACK_TYPE_NORMAL
        private constant damagetype DMG_TYPE = DAMAGE_TYPE_MAGIC
        private constant weapontype WPN_TYPE = null
        private constant string TARGET_DEATH_SFX = "Objects\\Spawnmodels\\Critters\\Albatross\\CritterBloodAlbatross.mdx"
        private constant string TARGET_DEATH_SFX_WHERE = "chest"
        private constant string MODEL_PATH = "Abilities\\Weapons\\WyvernSpear\\WyvernSpearMissile.mdx"
        private constant string MODEL_PATH_TWO = "Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl"
        //---------------------------------------
        private real array RANGE
        private group GROUP = CreateGroup()
        private player TempPlayer = null
        private unit TempUnit = null
        private group TempGroup = null
        private boolexpr G_UFilter = null
    endglobals

  private function SET_SPELL_RANGE takes nothing returns nothing
        set RANGE[1] = 800
        set RANGE[2] = 1000
        set RANGE[3] = 1200
    endfunction

private function SET_SPELL_DAMAGE takes integer level returns real
    if level == 3 then
        return 360.
    else
        return level * 120.
    endif
endfunction
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    private struct xxData
        unit Caster
        player Owner
        integer Level
        real cx
        real cy
        real Angle
        real Seconds = 0.00
        real Speed
        real Distance
        real DistT = 0.00
        
        group DamagedAlready = CreateGroup()

        real Damage
        real mx
        real my
        
        real Cosine
        real Sine
                
        xefx array myfx[3]
        static method create takes nothing returns xxData
            local xxData d = xxData.allocate()
            local real tx = GetSpellTargetX()
            local real ty = GetSpellTargetY()

            set d.Caster = GetTriggerUnit()
            set d.Owner = GetOwningPlayer( d.Caster )
            set d.Level = GetUnitAbilityLevel( d.Caster, SPELL_ID )
            set d.cx = GetUnitX( d.Caster )
            set d.cy = GetUnitY( d.Caster )
            set d.Angle = Atan2( ty - d.cy, tx - d.cx )
            set d.Cosine = Cos( d.Angle )
            set d.Sine   = Sin( d.Angle )
            
            set d.Damage = SET_SPELL_DAMAGE( d.Level )
            
            set d.myfx[1] = xefx.create( d.cx, d.cy, d.Angle)
            set d.myfx[1].z = 50
            set d.myfx[1].fxpath = MODEL_PATH
            set d.myfx[1].xyangle = d.Angle
            
            set d.myfx[2] = xefx.create( d.cx, d.cy, d.Angle )
            set d.myfx[2].z = 60
            set d.myfx[2].fxpath = MODEL_PATH_TWO
            set d.myfx[2].scale = 0.50
            set d.myfx[2].xyangle = d.Angle
            
            set d.Distance = RANGE[d.Level]
            set d.Speed = SPEED / ( 1 / TIMER_INTERVAL )
            
            set d.mx = d.cx
            set d.my = d.cy
            
            return d
        endmethod
    endstruct
    
    private function UFilter takes nothing returns boolean
        set TempUnit = GetFilterUnit()
        return IsUnitEnemy( TempUnit, TempPlayer ) and IsUnitType( TempUnit, UNIT_TYPE_DEAD ) == false /*
        */ and IsUnitType( TempUnit, UNIT_TYPE_STRUCTURE ) == false and IsUnitInGroup( TempUnit, TempGroup ) == false /*
        */ and GetUnitFlyHeight( TempUnit ) <= MODEL_HEIGHT
    endfunction
    
    private function Callback takes nothing returns boolean
        local xxData d = KT_GetData()
        local unit u = null
        
        set d.Seconds = d.Seconds + TIMER_INTERVAL
        
        set d.mx = d.mx + d.Speed * d.Cosine
        set d.my = d.my + d.Speed * d.Sine
        
        set d.myfx[1].x = d.mx
        set d.myfx[1].y = d.my

        set d.myfx[2].x = d.mx
        set d.myfx[2].y = d.my
        
        set TempPlayer = d.Owner
        set TempGroup = d.DamagedAlready
        call GroupEnumUnitsInRange( GROUP, d.mx, d.my, AOE, G_UFilter )
        loop
            set u = FirstOfGroup(GROUP)
            exitwhen u == null
            call GroupAddUnit( d.DamagedAlready, u )
            call DestroyEffect( AddSpecialEffectTarget( TARGET_DEATH_SFX, u, TARGET_DEATH_SFX_WHERE ) )
            call GroupRemoveUnit( GROUP, u )
            call UnitDamageTarget( d.Caster, u, d.Damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC, null )
        endloop
        call GroupClear( GROUP )
                
        set d.DistT = d.DistT + d.Speed
        if d.DistT > d.Distance then
            call GroupClear( d.DamagedAlready )
            call d.myfx[1].destroy()
            call d.myfx[2].destroy()
 call DestroyEffect (AddSpecialEffect ("Abilities\\Weapons\\GryphonRiderMissile\\GryphonRiderMissileTarget.mdl", d.mx, d.my))
            call d.destroy()
            return true
        endif

        return false
    endfunction

    private function Cond takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ID
    endfunction

    private function Action takes nothing returns nothing
        call KT_Add( function Callback, xxData.create(), TIMER_INTERVAL )
    endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Cond ) )
    call TriggerAddAction( t, function Action )
    
    set G_UFilter = Condition( function UFilter )
    call SET_SPELL_RANGE()
endfunction

endscope



The second spell is point target spell, which deals damage in area (like Moonsoon).

JASS:
scope LightningStrike
//******************************************************************************************************
// How to Implement: Copy and Paste The Spell Lightning Strike                                         *
//                   Copy and Paste this Trigger                                                       *
//                   You Probobly need to change the Rawcode, so go in Object Editor, and Press CTRL+D *
//                   Change "STRIKE_ID" to that Value                                                  *
//                   ABC IS REQUIRED                                                                   *
//******************************************************************************************************
globals
    constant real STRIKE_PERIODIC = 0.05        // This determines the speed of the Timer
    constant integer STRIKE_ID = 'A034'         // This is the Raw Code of the Ability
    constant integer STRIKE_ANGLES = 8          // This is the Number of Angles the Lightning Creates
    constant string STRIKE_LIGHTNING = "CLSB"   // Change this to change the look of the lightning
    constant string STRIKE_SFX_1 = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"              //Special effect 1
    constant string STRIKE_SFX_2 = "LightningsLong.mdx"                                                       //Special effect 2
    constant string STRIKE_SFX_3 = "Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl"//Special effect 3
    constant string STRIKE_SFX_4 = "Abilities\\Weapons\\Bolt\\BoltImpact.mdl"                                  //Special effect 4
    constant integer STRIKE_RADIUS = 170        // Determines the Max.Radius of the Lightning
    constant integer STRIKE_RADIUS_ADD = 50     // Determines the increment Max.Radius of the lightning  
    constant integer STRIKE_DAMAGE_INIT = 75    // Determines the Damage dealt on cast
    constant integer STRIKE_DAMAGE = 5          // Determines the Damage taken over Time
endglobals

//========= Don't Edit anything under this line unless you know what you are doing ===========================================

private struct Lightning
unit Caster
real Angle
location Target
real TargetX
real TargetY
real TargetLocationX
real TargetLocationY
real TargetX2
real TargetY2
real Alpha
integer Distance
integer Integer
group Group
lightning array Zap[100]
endstruct

//===============Spell RawCode Func======================================
private function Trig_Lightning_Strike_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == STRIKE_ID
endfunction

//===============Group Condition Func====================================
private function Trig_Lightning_Strike_Group takes nothing returns boolean
    return IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_MECHANICAL) == false and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE) == false
endfunction

//================Timer Function=========================================
private function Trig_Lightning_Strike_Timer takes nothing returns nothing
    local timer Timer = GetExpiredTimer()
    local unit PickedUnit
    local real PickedUnitX
    local real PickedUnitY
    local Lightning Data = GetTimerStructA(Timer)
    
    call GroupEnumUnitsInRange(Data.Group,Data.TargetLocationX,Data.TargetLocationY,Data.Distance,Condition(function Trig_Lightning_Strike_Group))
    loop
        set PickedUnit = FirstOfGroup(Data.Group)
        exitwhen PickedUnit == null
        if IsUnitEnemy(PickedUnit,GetOwningPlayer(Data.Caster)) then
            call UnitDamageTarget(Data.Caster,PickedUnit,STRIKE_DAMAGE,false,true,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_LIGHTNING,WEAPON_TYPE_WHOKNOWS)
            set PickedUnitX = GetUnitX(PickedUnit)
            set PickedUnitY = GetUnitY(PickedUnit)
            call DestroyEffect(AddSpecialEffectLoc(STRIKE_SFX_3,Location(PickedUnitX,PickedUnitY)))
        endif
        call GroupRemoveUnit(Data.Group, PickedUnit)
    endloop
    
    set PickedUnit = null
    
    set Data.Angle = 360/STRIKE_ANGLES
    set Data.Distance = Data.Distance + 14
    set Data.Alpha = Data.Alpha - 0.03
    
    loop
        exitwhen Data.Integer >= STRIKE_ANGLES
        set Data.TargetX = GetLocationX(Data.Target) + Data.Distance * Cos(Data.Angle * bj_DEGTORAD * Data.Integer)
        set Data.TargetY = GetLocationY(Data.Target) + Data.Distance * Sin(Data.Angle * bj_DEGTORAD * Data.Integer)
        set Data.TargetX2 = GetLocationX(Data.Target) + Data.Distance * Cos(Data.Angle * bj_DEGTORAD * (1 + Data.Integer))
        set Data.TargetY2 = GetLocationY(Data.Target) + Data.Distance * Sin(Data.Angle * bj_DEGTORAD * (1 + Data.Integer))
        call MoveLightning(Data.Zap[Data.Integer],false,Data.TargetX,Data.TargetY,Data.TargetX2,Data.TargetY2)
        call SetLightningColor(Data.Zap[Data.Integer],1,1,1,Data.Alpha)
        set Data.Integer = Data.Integer + 1
    endloop
    
    set Data.Integer = 0
    
    if Data.Distance >= STRIKE_RADIUS + STRIKE_RADIUS_ADD * GetUnitAbilityLevel(Data.Caster,STRIKE_ID) then
        loop
            exitwhen Data.Integer >= STRIKE_ANGLES
            call DestroyLightning(Data.Zap[Data.Integer])
            set Data.Integer = Data.Integer + 1
        endloop
        call RemoveLocation(Data.Target)
        set Data.Integer = 0
        call ClearTimerStructA(Timer)
        call Data.destroy()
        call PauseTimer(Timer)
        call DestroyTimer(Timer)
    endif
    set Timer = null
endfunction

    
//================Main Function==========================================
private function Trig_Lightning_Strike_Actions takes nothing returns nothing
    local Lightning Data = Lightning.create()
    local timer Timer = CreateTimer()
    local unit PickedUnit
    
    set Data.Caster = GetTriggerUnit()
    set Data.Angle = 360/STRIKE_ANGLES
    set Data.Distance = 0
    set Data.Alpha = 1
    set Data.Group = CreateGroup()
    set Data.Target = GetSpellTargetLoc()
    set Data.TargetLocationX = GetLocationX(Data.Target)
    set Data.TargetLocationY = GetLocationY(Data.Target)
    
    call DestroyEffect(AddSpecialEffectLoc(STRIKE_SFX_1,Location(Data.TargetLocationX,Data.TargetLocationY)))
    call DestroyEffect(AddSpecialEffectLoc(STRIKE_SFX_2,Location(Data.TargetLocationX,Data.TargetLocationY)))
    
    call GroupEnumUnitsInRange(Data.Group,Data.TargetLocationX,Data.TargetLocationY,STRIKE_RADIUS + STRIKE_RADIUS_ADD,Condition(function Trig_Lightning_Strike_Group))
    loop
        set PickedUnit = FirstOfGroup(Data.Group)
        exitwhen PickedUnit == null
        if IsUnitEnemy(PickedUnit,GetOwningPlayer(Data.Caster)) then
            call UnitDamageTarget(Data.Caster,PickedUnit,STRIKE_DAMAGE_INIT * GetUnitAbilityLevel(Data.Caster,STRIKE_ID),false,true,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_LIGHTNING,WEAPON_TYPE_WHOKNOWS)
            call DestroyEffect(AddSpecialEffectTarget(STRIKE_SFX_4,PickedUnit,"chest"))
        endif
        call GroupRemoveUnit(Data.Group, PickedUnit)
    endloop
    
    set PickedUnit = null
    
    loop
        exitwhen Data.Integer >= STRIKE_ANGLES
        set Data.TargetX = GetLocationX(Data.Target) + Data.Distance * Cos(Data.Angle * bj_DEGTORAD * Data.Integer)
        set Data.TargetY = GetLocationY(Data.Target) + Data.Distance * Sin(Data.Angle * bj_DEGTORAD * Data.Integer)
        set Data.TargetX2 = GetLocationX(Data.Target) + Data.Distance * Cos(Data.Angle * bj_DEGTORAD * (1 + Data.Integer))
        set Data.TargetY2 = GetLocationY(Data.Target) + Data.Distance * Sin(Data.Angle * bj_DEGTORAD * (1 + Data.Integer))
        set Data.Zap[Data.Integer] = AddLightning(STRIKE_LIGHTNING,false,Data.TargetX,Data.TargetY,Data.TargetX2,Data.TargetY2)
        call SetLightningColor(Data.Zap[Data.Integer],1,1,1,Data.Alpha)
        set Data.Integer = Data.Integer + 1
    endloop
    
    set Data.Integer = 0
    
    call SetTimerStructA(Timer, Data)
    
    call TimerStart(Timer,STRIKE_PERIODIC,true,function Trig_Lightning_Strike_Timer)
endfunction
//===========================================================================
function InitTrig_Lightning_Strike takes nothing returns nothing
    local trigger Lightning_Strike = CreateTrigger(  )
    call Preload("Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
    call Preload("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
    call Preload("LightningsLong.mdx")
    call Preload("Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl")
    call TriggerRegisterAnyUnitEventBJ( Lightning_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( Lightning_Strike, Condition( function Trig_Lightning_Strike_Conditions ) )
    call TriggerAddAction( Lightning_Strike, function Trig_Lightning_Strike_Actions )
endfunction
endscope
 

watermelon

New Member
Reaction score
2
Why not just make a dummy unit with some sight range, place it at the points that you want visible to the player, and use UnitApplyTimedLife?
I'm not really sure what you're asking for.
 

Crusher

You can change this now in User CP.
Reaction score
121
I'm asking to add vision to those spells once they are casted, from point A to point B.

A (Caster) --------> B (Point)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top