1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  4. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  5. The results are out! Check them out.
    Dismiss Notice
  6. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  7. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Fire Bomber

Discussion in 'Triggers & Scripts' started by Flame_Phoenix, Dec 7, 2007.

  1. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    I don't refuse to learn. In fact I want to, but i can't !!! I can't find a good website that explains that sort of stuff ... they always give us some stupid example and then say "here is the code, the rest is your problem". And the I can't understand what they want me to do, or how they did it !

    The only reason i hate those system is because i can NOT understand a single line of what they do !! besides, why complicate ? they are not needed ...

    But please if you know of a DECENT tutorial about those crazy systems, plz let me know it ..
     
  2. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    I was talking about ghostwolf -.-
     
  3. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    ....... no comments ... I am testing your suggestions now O2 ...

    EDIT

    IT WORKS !!!! MUHAHAHAHAHHA HE NO LONGER MISSES THE TARGET !!!

    DIRECTLY FROM THE BULLSEYE GNOMISH SCHOOL : BEHOLD, MY PLANE !!! LOL


    PS: thx you so much the two of you. I am not using Wolf's version, although I may include it in my spell map, if he allows me to.
    Now, I only need to know How to make those stupid bombs die !!!

    Yes, I can't kill the bombs before they get to the ground, and I want the bombs to quit the plane in a succession (in an order, like it is happening now). So, this means that although i can drop 6 bombs, one after the other, I can't kill them instantly ...

    Maybe I am not explaining myself correctly:
    Here, just take my this code, and kill add a Kill Bomb call, to see what will happen (ps add the kill bomb in the bombs loop):

    Code (vJASS):

    globals
        trigger gg_trg_Bomber
    endglobals
    //=============================================================
    function Trig_Bomber_Conditions takes nothing returns boolean
        return GetSpellAbilityId() == 'A000'
    endfunction
    //=============================================================
    function Trig_Bomber_Actions takes nothing returns nothing
        local unit caster = GetTriggerUnit()
        local real angle = GetUnitFacing(caster)
        local location loc = GetSpellTargetLoc()
        local real X = GetLocationX(loc)
        local real Y = GetLocationY(loc)
        local player p = GetOwningPlayer(caster)
        local unit bomb
        local integer fade = 0
        local real height
        local integer bombcounter = 0
        local real heightbomb
       
        local unit bomber = CreateUnit(p, 'h002', X - 1450 * Cos(angle * (3.14159 / 180.0)), Y - 1450 * Sin(angle * (3.14159 / 180.0)), angle)
       
        call SetUnitVertexColor(bomber, 255, 255, 255, fade)
        set height = GetUnitFlyHeight(bomber)
       
        call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))
       
        loop
            exitwhen(fade >= 255)
            call TriggerSleepAction(0.1)
            call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))
            set fade = fade + 30
            call SetUnitVertexColor(bomber, 255, 255, 255, fade)
        endloop
       
        loop
            exitwhen(height <= 450)
            set height = height - 50
            call SetUnitFlyHeight(bomber, height, 80)
            call TriggerSleepAction(0.3)
            call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))
        endloop
       
            call TriggerSleepAction(0.6)
            call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))    
        loop
            exitwhen(bombcounter == 6)
            call IssuePointOrder( bomber, "move", X + 500 * Cos(angle * (3.14159 / 180.0)), Y + 500 * Sin(angle * (3.14159 / 180.0)))        
            set bomb = CreateUnitAtLoc(p, 'h003', GetUnitLoc(bomber), 270.0)
            call SetUnitFlyHeight(bomb, height, 0)
            set heightbomb = height
            loop
                exitwhen(heightbomb <= 0)
                set heightbomb = heightbomb - 120
                call SetUnitFlyHeight(bomb, heightbomb, 120)
            endloop
            set bombcounter = bombcounter + 1
            call TriggerSleepAction(0.25)
        endloop
       
        call IssuePointOrder( bomber, "move", X + 2000 * Cos(angle * (3.14159 / 180.0)), Y + 2000 * Sin(angle * (3.14159 / 180.0)))
        call TriggerSleepAction(0.2)
           
        loop
            exitwhen(height >= 600)      
            set height = height + 50
            call SetUnitFlyHeight(bomber, height, 100)    
            call TriggerSleepAction(0.2)
        endloop
       
        loop
            exitwhen(fade <= 0)
            call TriggerSleepAction(0.1)
           
            set fade = fade - 30
            call SetUnitVertexColor(bomber, 255, 255, 255, fade)
        endloop
       
        call ShowUnit(bomber, false)
        call KillUnit(bomber)
        call RemoveLocation(loc)
       
        set loc = null
        set bomber = null
        set bomb = null
        set caster = null
        set p = null
    endfunction
    //===========================================================================
    function InitTrig_Bomber takes nothing returns nothing
        set gg_trg_Bomber = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( gg_trg_Bomber, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddCondition( gg_trg_Bomber, Condition( function Trig_Bomber_Conditions ) )
        call TriggerAddAction( gg_trg_Bomber, function Trig_Bomber_Actions )
    endfunction


    EDIT

    I've been studying how ghostwolf kills the bombs in his code. I must admit that it is quite interesting. He treats each bomb as a single object, and still there is no need for globals or such, thus making the spell MUI as well.

    However, the use of that system complicates my life. That is why I will try to avoid it as much as possible. However, in the end, if I find no other solution, I will use his way of doing things.





    EDIT EDIT EDIT EDIT EDIT EDIT EDIT EDIT EDIT EDIT

    MEGA EDIT, GODLIKE EDIT, COMBO... EDIT !!!


    Hey guys !!!
    IT IS DONE !!! I DID IT (lol), although I must thx you for all your help.

    I managed to make the bombs explode! now everything works in harmony !=P

    I remembered: I need to kill the bombs, but how to do it ??? Well, the answer was simple: addLifeTime !! (lol)

    So when the time expires, the bomb dies, and voilá ! BOM BOM BOM BOM BOM BOM (lol)

    I know I managed to end the code, but I am still opened to suggestions about how to improve it (as long as it doesn't involve some system).
    Here are the two trigger of the code:

    [jass=Bomber]
    function Trig_Bomber_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
    endfunction
    //=============================================================
    function Trig_Bomber_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local real angle = GetUnitFacing(caster)
    local location loc = GetSpellTargetLoc()
    local real X = GetLocationX(loc)
    local real Y = GetLocationY(loc)
    local player p = GetOwningPlayer(caster)
    local unit bomb
    local integer fade = 0
    local real height
    local integer bombcounter = 0
    local real heightbomb

    local unit bomber = CreateUnit(p, 'h002', X - 1450 * Cos(angle * (3.14159 / 180.0)), Y - 1450 * Sin(angle * (3.14159 / 180.0)), angle)

    call SetUnitVertexColor(bomber, 255, 255, 255, fade)
    set height = GetUnitFlyHeight(bomber)

    call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))

    loop
    exitwhen(fade >= 255)
    call TriggerSleepAction(0.1)
    call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))
    set fade = fade + 30
    call SetUnitVertexColor(bomber, 255, 255, 255, fade)
    endloop

    loop
    exitwhen(height <= 450)
    set height = height - 50
    call SetUnitFlyHeight(bomber, height, 80)
    call TriggerSleepAction(0.3)
    call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))
    endloop

    call TriggerSleepAction(0.6)
    call IssuePointOrder( bomber, "move", X + 200 * Cos(angle * (3.14159 / 180.0)), Y + 200 * Sin(angle * (3.14159 / 180.0)))
    loop
    exitwhen(bombcounter == 6)
    call IssuePointOrder( bomber, "move", X + 500 * Cos(angle * (3.14159 / 180.0)), Y + 500 * Sin(angle * (3.14159 / 180.0)))
    set bomb = CreateUnitAtLoc(p, 'h003', GetUnitLoc(bomber), 270.0)
    call SetUnitFlyHeight(bomb, height, 0)
    set heightbomb = height
    call UnitApplyTimedLife( bomb,'BHwe', 3)
    loop
    exitwhen(heightbomb <= 0)
    set heightbomb = heightbomb - 100
    call SetUnitFlyHeight(bomb, heightbomb, 140)
    endloop
    set bombcounter = bombcounter + 1
    call TriggerSleepAction(0.25)
    endloop

    call IssuePointOrder( bomber, "move", X + 2000 * Cos(angle * (3.14159 / 180.0)), Y + 2000 * Sin(angle * (3.14159 / 180.0)))
    call TriggerSleepAction(0.2)

    loop
    exitwhen(height >= 600)
    set height = height + 50
    call SetUnitFlyHeight(bomber, height, 100)
    call TriggerSleepAction(0.2)
    endloop

    loop
    exitwhen(fade <= 0)
    call TriggerSleepAction(0.1)

    set fade = fade - 30
    call SetUnitVertexColor(bomber, 255, 255, 255, fade)
    endloop

    call ShowUnit(bomber, false)
    call KillUnit(bomber)
    call RemoveLocation(loc)

    set loc = null
    set bomber = null
    set bomb = null
    set caster = null
    set p = null
    endfunction
    //===========================================================================
    function InitTrig_Bomber takes nothing returns nothing
    set gg_trg_Bomber = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Bomber, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Bomber, Condition( function Trig_Bomber_Conditions ) )
    call TriggerAddAction( gg_trg_Bomber, function Trig_Bomber_Actions )
    endfunction[/jass]
    This is the trigger for the plane. It creates the plane, makes him move and drop the bombs.

    [jass=Bombs]
    function Trig_Bombs_Actions takes nothing returns nothing
    local unit bomb = GetDyingUnit()
    local integer bombID = GetUnitTypeId(bomb)
    local player p = GetOwningPlayer(bomb)
    local unit f
    local group targets
    local unit dummy
    local effect e
    if bombID == 'h003' then
    set e = AddSpecialEffect("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", GetUnitX(bomb), GetUnitY(bomb))
    set targets = CreateGroup()
    call GroupEnumUnitsInRange( targets, GetUnitX( bomb ), GetUnitY( bomb ), 500, Filter(null) )
    loop
    set f = FirstOfGroup(targets)
    exitwhen f == null
    if IsUnitEnemy(f, p) then
    call SetWidgetLife(f, GetWidgetLife(f) - 350)
    endif
    call GroupRemoveUnit(targets,f)
    endloop
    call DestroyGroup(targets)
    call DestroyEffect(e)
    endif
    set bomb = null
    set p = null
    set f = null
    set targets = null
    set dummy = null
    set e = null
    endfunction
    //===========================================================================
    function InitTrig_Bombs takes nothing returns nothing
    set gg_trg_Bombs = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Bombs, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Bombs, function Trig_Bombs_Actions )
    endfunction[/jass]

    This is the trigger for my fire bomb !! Plz note, it is not done yet, the bomb will be an incendiary bomb, so when it explodes, it will leave the ground burning. I will create a dummy unit and a dummy ability to do so, but for now, I just want your opinion.


    Its all for now =)
    Thx for your help, now I can create any kind of bomb I want !!!
    I am thinking of:
    1 - Incendiary bomb: explodes and burns
    2 - Ice bomb: The explosion deals ice damage (or freezes, dunno yet)
    3 - Gas Bomb: my favorite, the exploding sound will be an Ogre fart (lol), and it will create a poison cloud based on Cloud (from the Elven Raider). Units inside that cloud will suffer of something (dunno yet lol).
    4 - Atomic Bomb: this one is a Cliché for any bomber spell
    5 - I am opened for more suggestions =)
     
  4. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,836
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    I never refused to learn vJass, im just too lazy for it :p

    Allow ? lol I made it for you... (I was more expecting a "WOW THANKS THIS IS AWESOM" but whatever... *cries*... ^^).

    Do you mean Kattana's handle local vars by "system" ? you really should learn how to use it (or use tables or structs or whatever...), moving locals from one function to another is defiantly a needed thing.
     
  5. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Wolf, I appreciate greatly your help. Without you (and O2) I would have never succeeded.
    However I will not use your code because:
    1 - I discovered a way of using mine
    2 - I find my code way easier
    3 - I understand nothing of Katana's something something, and I make no idea on how to use it.

    However, I also know you took great effort to help me and create that trigger. I don't forget that, and that's why i want to make good use of it: it would be a shame to let your work become unknown, after so much effort.

    Does Katana's something something allow me to move locals between different functions ?
    I agree that is a major needing, at least for me. I get stuck most of the time, because i can't do that.
    However, people say (including some expert people) that such system are not useful. You can do everything without them.
    How is it going to be ? Who is rit ?
    You seem to have experience with that system. Where can I read decent tutorials about it ??

    Anyway, if you guys find an error in my code, or something that can be improved, please let me know. I will change it =) (maybe lol)
     
  6. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,836
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    I can't see how you can move locals between functions without such things.
    And I don't think there is a good tutorial anyway.

    You kinda "stick" your local to a timer and then "summon" it back in the timer actions, something like this

    Code (vJASS):
    function timeractions takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local unit someUnit = GetHandleUnit(t, "someString") // here you use GET-handle-TYPE(use unit here, not handle),
        // you do not need to put the value since you already set it before
        //
        // do something
        //
        call FlushHandleLocals(t) // every time when you want to dostroy your timers, you'll need to delete the things
        // you stuck into it with this command.
        call DestroyTimer(t)
        set t = null
        set someUnit = null
    endfunction
    function bla takes nothing returns nothing
        local timer t = CreateTimer()
        local unit someUnit = someUnit
        call SetHandleHandle(t, "someString", someUnit) // setting a unit is HandleHandle, integer is HandleInt, etc.
        // so, you "stick" it to your timer - t , you then give it a name you will call it with later, and a value so its
        // SetHandleVARIABLETYPE(yourTimer, "yourString", yourValue)
        // the types (as you can see in Kattana's script) are Handle(unit),Int,Real,Boolean,String.
        call TimerStart(t, 1, false, function timeractions)
        set t = null
        set someUnit = null
    endfunction



    Hope this helps.
     
  7. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Meh ... confusing ... I need timers, then I attach units to them, and then I kill Timers plus the units ... somewhat ... confusing ...

    Anyway, Here is My incendiary Bomb spell !!!
    It only has 1 level, because it is for an Item =P
    Hope you like it =)

    PS: because the effects take huge memory, it will lag if you mass use it, so be careful.

    Description: A plane comes out of nowhere, and drops 6 bombs. Each bomb will deal 50 damage to units, and 75 to buildings. After the explosion, the ground will burn for 20 seconds, burning and killing all units on it.

    Hope you like it, give suggestions =p

    I use my code here, Wolfs code will be used in the map intent to submit to the spells section.
     

    Attached Files:

  8. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,836
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    " set bomb = CreateUnitAtLoc(p, 'h003', GetUnitLoc(bomber), 270.0)
    " , this leaks a point.

    Besides, I checked it and it still bugs a lot of times.
     
  9. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Mmm, that is when I create the Bomb. Ok, I will fix that asap.

    Btw, it is buggy !? where !? I found no bugs, everything works as it is supposed to... tell me where. so I can fix them plz.

    Please report if you find anything else.
     
  10. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,836
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    Well the plain sure goes straight now, the matter is - a lot of time he goes to the wrong direction.

    Check this with pointing the target point to somewhere behind the caster for example.
     
  11. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    MM, i don't understand what you mean ... it would do the same in your code ... The plane goes where it has to, the problem is that he redirects his trajectory every loop. Instead of telling him where to go in 1 order, I do so in many little orders. It's like dividing his trajectory into small pieces, and then making the plane make those pieces nicely and correctly. I don't see what the problem is here. Besides I followed O2's suggestion =S

    EDIT
    Corrected that small location leak. Now I use GetUnitX and GetUnitY. thx =)
     
  12. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,836
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    This is what im talking about. It happend to me about 5/7 times.
     

    Attached Files:

  13. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    OMG !, did you downloaded the map I posted today !? (lol you did).
    That is freaking impossible. That has to be an error from your WE. With the new code, that never happened to me, never.

    The closest thing I have to that, is the fact that sometimes (in the first 1 or 2 secs of life of the plane), the plane changes angle to go to where he has to.

    That never happened to me while I was testing ... your report is certainly weird to me ....

    Anyway, did you like the incendiary effect ?
     
    Last edited: Feb 15, 2008
  14. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,836
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    I tested it again, its actualy like this.

    It comes to the right spot from the wrong direction (which is way cooler lol ! :p).

    About the bombs themselves - they fall toooooo slow.
    And they lag tooooo much.
    There is no point in a spell if it lags in 1-2 casts in single player in a map without doodads/units/anything.
     

    Attached Files:

  15. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Mmm, That is nearly impossible ... How can how target a location, if you are in the opposite angle ??! It's like me trying to slap some one behind me, I just can't (or shouldn't be able to).

    About the lags, The lag is not caused by the code, It is caused by the effects .... Unfortunately, the effects take huge size of memory, and make the game lag.

    If you have suggestions about how to reduce the lag of my spell, I would like very much to hear them please.

    Although I could remove some effects ... but it wouldn't be the same thing if you understand me =S
     
  16. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,836
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    That is the start frame.
    Try to cast behind the caster and see what happens.

    I know, just remove some of the effects, it doesn't need to be super-effecty lol.


    Just as a general feedback, it looks a bit stupid that the plain flies so low (500 is low...).
     
  17. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Mmmmm
    After making some thinking, I decided to do some changes:
    1 - The plane will not drop 6 bombs, but 5
    2 - The bombs will no longer explode, they will just burn the ground
    3 - I like the plane going down, it gives him a nice effect (lol). The plane starts with 600 height, and the it goes down until 450. I may change this value to 500 to see if it looks better
    4 - I will replace the fire effect, with a dummy unit. This way I will be able to clear memory faster, because I don't have to wait 20 seconds.

    Mm, yes, you are correct GhostWolf. If my caster casts the spell, from the opposite angle, the plane will still hit the target, but it will be created on the wrong angle.
    If my code does it, your code will do it as well rit ?

    I will now perform some of the changes. I will post the new map when I am done with it.
     
  18. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,836
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    My code doesn't do it.
    Yours does because you based your angle (although I clearly told you not too :con:) on facing of unit instead of the angle between the caster and the target.
     
  19. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Mmmm, so you are saying that because I base my Angle in the facing angle of the caster, My plane goes crazy rit ??

    Ok, So, how do I change my code, to apply your suggestion ?
     
  20. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,836
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    You either set 2 locations to the target and the caster and check angle between them, or use a customized coordinates angle checker like this one

    Code (vJASS):
    //****************************************************************************************
    //               Angle between two points using coordinates
    // call AngleBetweenPointsXY(real x1, real y1, real x2, real y2)

    function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
        return bj_RADTODEG * Atan2(y2 - y1, x2 - x1)
    endfunction