• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need help for this spell <GUI>

Status
Not open for further replies.
Level 5
Joined
Jan 23, 2014
Messages
152
I want to make a laser spell explode on the target point. I've been working on this for hours, but I can't figure out how. I can't offset the laser dummy's points (laser path) because it won't always be accurate. Can someone please help?
 

Attachments

  • KizaruSpells.w3x
    350.6 KB · Views: 28
Level 5
Joined
Jan 23, 2014
Messages
152
I don't have the trigger because I don't know how to start it. Okay, so the range of the spell is 1800. It's an AoE spell that explodes when the laser reaches the targeted point. If I create a laser dummy and offset some points for the laser path,for example 3 points which are 600 units apart, it won't always be accurate because if the spell was targeted in less than 1800 range, let's say 1200, then the laser would go beyond the target point since it's path was offset by 600 each which sums to 1800. I'm sorry if this is hard to understand.
 
Level 5
Joined
Jan 23, 2014
Messages
152
It would be better if you could see it for yourself. The spell I'm trying to make is the same as the spell in the attached file, but it's in Jass and I know nothing about it, so I just copied the imported files and tried to make it in GUI. Should've started with this sorry.
 

Attachments

  • Kizaru.w3x
    282.1 KB · Views: 45
Level 5
Joined
Jan 23, 2014
Messages
152
Here:
JASS:
//TESH.scrollpos=-1
//TESH.alwaysfold=0
include "cj_types.j"
library LightFinger initializer init {

    define{
    private DMG = 250 //____
    private Speed = 70 //________ (__ 40-70 ________ _________)
    private Area = 400 //_______ _____ (__ ________ _______ _______ _ __________ __ _____ __, ___________ "Slow")
    private Spell = 'A000'
    private DamageUp = 50 //_______ _____ __ _______
    private Per = 0.03 // ________ _______
    //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    private DMGUP = DMG+(GetUnitAbilityLevel(Caster,Spell)*50)
    }
    
    globals
    hashtable h = null
    unit e = null
    private unit Caster
    endglobals
    
    private function PreloadUnit takes int id returns nothing
        bj_lastCreatedUnit = CreateUnit(Player(12), id, 0, 0, 0)
        SetUnitVertexColor(bj_lastCreatedUnit, 255, 255, 255, 1)
        KillUnit(bj_lastCreatedUnit)
    endfunction

    private function SR takes real x1, real y1, real x2, real y2 returns real
        return SquareRoot((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))
    endfunction

    private function ShakeCamera2 takes nothing returns nothing
        CameraSetSourceNoise(0, 0)
        CameraSetTargetNoise(0, 0)
        PauseTimer(GetExpiredTimer())
        DestroyTimer(GetExpiredTimer())
    endfunction

    private function ShakeCamera takes real dur, real potency returns nothing
        timer t = CreateTimer()
        CameraSetTargetNoiseEx(2 * potency, 2 * Pow(10, potency), true)
        CameraSetSourceNoiseEx(2 * potency, 2 * Pow(10, potency), true)
        TimerStart(t, dur, false, function ShakeCamera2)
        t = null
    endfunction

    private boolean CondFinger() {
    return GetSpellAbilityId() == Spell
    }

    function CastFinger2 takes nothing returns nothing
        timer t = GetExpiredTimer()
        int id = GetHandleId(t)
        unit u = LoadUnitHandle(h, id, 0)
        unit d = LoadUnitHandle(h, id, 1)
        real x = GetUnitX(d)
        real y = GetUnitY(d)
        real x1 = LoadReal(h, id, 2)
        real y1 = LoadReal(h, id, 3)
        real a = Atan2(y1 - y, x1 - x)
        group g = CreateGroup()
        player p = GetOwningPlayer(u)
        if SR(x, y, x1, y1) > 52 {
            x = x + Speed * Cos(a)
            y = y + Speed * Sin(a)
            SetUnitX(d, x)
            SetUnitY(d, y)
            SetUnitFacing(d, a * bj_RADTODEG)
            bj_lastCreatedUnit = CreateUnit(p, 'e000', x, y, a * bj_RADTODEG)
            UnitApplyTimedLife(bj_lastCreatedUnit, 0, 1)
            SetUnitTimeScale(bj_lastCreatedUnit, 0)
            UnitApplyTimedLife(CreateUnit(p, 'e004', x, y, a * bj_RADTODEG), 0, 1)
        else
            GroupEnumUnitsInRange(g, x1, y1, Area, null)
            Caster = u
            loop
                e = FirstOfGroup(g)
                exitwhen e == null
                if IsUnitEnemy(e, p) and IsUnitType(e, UNIT_TYPE_DEAD) == false and GetUnitAbilityLevel(e, 'Aloc') == 0{
                    UnitDamageTarget(u, e, DMGUP, false, false, null, null, null)
                    }
                    GroupRemoveUnit(g, e)
                endloop
                bj_lastCreatedUnit = CreateUnit(p, 'e001', x, y, a * bj_RADTODEG)
                UnitApplyTimedLife(bj_lastCreatedUnit, 0, 1)
                IssueImmediateOrderById(bj_lastCreatedUnit, 852285)
                UnitApplyTimedLife(CreateUnit(p, 'e002', x, y, a * bj_RADTODEG), 0, 1)
                UnitApplyTimedLife(CreateUnit(p, 'e003', x, y, a * bj_RADTODEG), 0, 1)
                DestroyEffect(AddSpecialEffect("war3mapImported\\NUKE2.mdx", x1, y1))
                DestroyEffect(AddSpecialEffect("war3mapImported\\NewMassiveEX.mdx", x1, y1))
                DestroyEffect(AddSpecialEffect("war3mapImported\\a-bomb.mdx", x1, y1))
                DestroyEffect(AddSpecialEffect("war3mapImported\\NuclearExplosion.mdx", x1, y1))
                ShakeCamera(0.5, 20)
                RemoveUnit(d)
                PauseTimer(t)
                DestroyTimer(t)
                DestroyEffect(LoadEffectHandle(h, id, 5))
                FlushChildHashtable(h, id)
                }
                DestroyGroup(g)
                p = null
                u = null
                t = null
                g = null
                d = null
            endfunction

            private void CastFinger(){
            timer t = CreateTimer()
            int id = GetHandleId(t)
            unit u = GetTriggerUnit()
            real x = GetUnitX(u)
            real y = GetUnitY(u)
            player p = GetOwningPlayer(u)
            SaveUnitHandle(h, id, 0, u)
            UnitApplyTimedLife(CreateUnit(p, 'e005', x, y, 0), 0, 1)
            bj_lastCreatedUnit = CreateUnit(p, 'e000', x, y, GetUnitFacing(u))
            SaveUnitHandle(h, id, 1, bj_lastCreatedUnit)
            SetUnitTimeScale(bj_lastCreatedUnit, 0)
            SaveEffectHandle(h, id, 5, AddSpecialEffectTarget("war3mapImported\\!guang small.mdx", u, "foot right"))
            DestroyEffect(AddSpecialEffectTarget("war3mapImported\\WarpHolyCaster.mdx", u, "origin"))
            DestroyEffect(AddSpecialEffectTarget("war3mapImported\\Consecrate.mdx", u, "chest"))
            DestroyEffect(AddSpecialEffectTarget("war3mapImported\\HolyPhoenixMissle.mdx", u, "origin"))
            SaveReal(h, id, 2, GetSpellTargetX())
            SaveReal(h, id, 3, GetSpellTargetY())
            TimerStart(t, Per, true, function CastFinger2)
            t = null
            p = null
            u = null
            }

            private void init (){
            trigger t = CreateTrigger()
            integer i = 0
            loop
                TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
                i++ 
                exitwhen i == bj_MAX_PLAYER_SLOTS
            endloop
            TriggerAddAction(t, function CastFinger)
            TriggerAddCondition(t, Condition(function CondFinger))
            h = InitHashtable()
            PreloadUnit('e000')
            PreloadUnit('e001')
            PreloadUnit('e002')
            PreloadUnit('e003')
            PreloadUnit('e004')
            PreloadUnit('e005')
            Preload("war3mapImported\\WarpHolyCaster.mdx")
            Preload("war3mapImported\\Consecrate.mdx")
            Preload("war3mapImported\\HolyPhoenixMissle.mdx")
            Preload("war3mapImported\\!guang small.mdx")
            Preload("war3mapImported\\NUKE2.mdx")
            Preload("war3mapImported\\NewMassiveEX.mdx")
            Preload("war3mapImported\\a-bomb.mdx")
            Preload("war3mapImported\\NuclearExplosion.mdx")
            t = null
            }
            }


//Code indented using The_Witcher's Script language Aligner
//Download the newest version and report bugs at [url]www.hiveworkshop.com[/url]
 
Status
Not open for further replies.
Top