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. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. 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
    Hi guys, i am trying to make a spell which calls a plane that drops incendiary bombs.

    Blizzard made a spell like i want to, it is in (6)BomberCommand map. I tried to evaluate the codes and to learn from them, but they are just to complex for me ... Can any1 plz tell me how i can use incendiary bomber in my map ?

    I know you guys have the map, but i will attach it anyway ...

    Plz help ? i would really love to learn this ..
     

    Attached Files:

  2. busterkomo

    busterkomo

    Joined:
    Jun 17, 2007
    Messages:
    1,423
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Currently inspecting the map, should only take a few moments...
    Which trigger contains the spell you're looking for?
     
  3. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Thx for your reply. Well, you see, that is the problem. If the spell and code were contained in only 1 trigger, it would be no problem for me.

    However, there are functions all over the map. The map header is of crucial importance for the entire system to work properly, than you have the fade out triggers, the damage triggers the unit triggers, the flight triggers and the effect triggers, all over the map together with the training triggers, score triggers, camera triggers and ability triggers.

    It is nearly impossible to distinguish, you can't delete one trigger without causing problem in the others.

    The fire bomber triggers can be found in the bomber trigger, plane trigger, plane type and others. I mainly studied this 3, but is impossible to distinguish things.

    You also have Global variables.... which join to the party just to make our life more difficult than it already is ....

    This is why I posted this question in this forum, because I really think I could use some help on this.

    I already tried to isolate the main triggers, but the result was a complete failure, there is no way i can do it without destroying the map ....

    Help !?

    EDIT

    Ok, so i've already waited too long from help. Therefore i decided to create my own bomber ability.
    After some frustrated evaluation of the map, i searched for maps in the spell sections and the result was in fact better then i expected.

    I will start simple.

    Code (vJASS):
    function Trig_Fire_Bomber_Conditions takes nothing returns boolean
        return GetSpellAbilityId() == 'A000'
    endfunction
    //===========================================================================
    function Trig_Fire_Bomber_Actions takes nothing returns nothing
        local unit bomber
        local unit bomb
        local player p = GetTriggerPlayer()
        local location m = GetSpellTargetLoc()
        call CreateUnit(p, 'h002', GetLocationX(m) + 500, GetLocationY(m) + 500, 90)
        set bomber = GetLastCreatedUnit()
        call IssuePointOrder( bomber, "move", GetLocationX(m)- 5000, GetLocationY(m)- 5000)
    endfunction

    //===========================================================================
    function InitTrig_Fire_Bomber takes nothing returns nothing
        set gg_trg_Fire_Bomber = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Bomber, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddCondition( gg_trg_Fire_Bomber, Condition( function Trig_Fire_Bomber_Conditions ) )
        call TriggerAddAction( gg_trg_Fire_Bomber, function Trig_Fire_Bomber_Actions )
    endfunction
     

    here is my code.

    This code does not work as it should.
    I would like to create a unit (bomber) with polar offset, but my JASS knowledge does not allow me to do so freely.

    I would like to create the bomber 500 meters away from the casting point, and facing that same casting point.
    The bomber would move, pass through the casting point (500 meters) and then leave.

    It would be something like this

    Code (vJASS):

    function Trig_Fire_Bomber_Actions takes nothing returns nothing
        local unit bomber
        local unit bomb
        local player p = GetTriggerPlayer()
        local location m = GetSpellTargetLoc()
        call **Create a unit facing the casting point, and that is 500 meters away from it**
        set bomber = GetLastCreatedUnit()
        call **Issue the unit an order to pass 500 meters through the casting point**
        //other actions.
    endfunction


    I tried to use a "Create Unit With Polar Offset" from GUI and to convert it after, but the result was confusing laggy and had lots of leaks.

    Therefore i must ask for your help.
    Can you guys tell me how to do this ?



    EDIT

    Guys i made some advances in my trigger.
    Now the unit is created where i want, but the "move" part is messed up... when the unit is moving, it performs an arc .. and i just want it to move it a rect direct straight line ...

    Can you guys please help me with the move call ??

    Oh and my script now will surely lag like hell ... if you guys have good suggestions to reduce lag, i would like to hear them ...

    Code (vJASS):
    function Trig_Fire_Bomber_Conditions takes nothing returns boolean
        return GetSpellAbilityId() == 'A000'
    endfunction
    //===========================================================================
    function Trig_Fire_Bomber_Actions takes nothing returns nothing
        local unit bomber
        local unit bomb
        local player p = GetOwningPlayer(GetSpellAbilityUnit())
        local location m = GetSpellTargetLoc()          
        local real angle
        call CreateNUnitsAtLoc( 1, 'h002', p, PolarProjectionBJ(m, -1500, AngleBetweenPoints(GetUnitLoc(GetTriggerUnit()), m)), bj_UNIT_FACING )
        set bomber = GetLastCreatedUnit()
        set angle = AngleBetweenPoints(GetUnitLoc(bomber), m)
        call IssuePointOrderLoc( bomber, "move", PolarProjectionBJ(m, 1000.00, angle) )
        call RemoveLocation(m)
        set bomber = null
        set bomb = null
        set p = null
        set m = null
    endfunction

    //===========================================================================
    function InitTrig_Fire_Bomber takes nothing returns nothing
        set gg_trg_Fire_Bomber = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Bomber, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddCondition( gg_trg_Fire_Bomber, Condition( function Trig_Fire_Bomber_Conditions ) )
        call TriggerAddAction( gg_trg_Fire_Bomber, function Trig_Fire_Bomber_Actions )
    endfunction
     
    Last edited: Jan 27, 2008
  4. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    :/ I guess you will need some handlevars or vjass ... or not
     
  5. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    This spell does not require any handle vars neither vjass ...

    I just want to make the unit move !!! How difficult is that !?
    Besides i've already seen a spell like mine 100% GUI.

    But our spells are different, that's why i am asking for help.
     
  6. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    %100 GUI hmm sounds possible but Im talking about MUI and without variables
    I never make anyspell with variables or not MUI that would suck
     
  7. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    The spell is so fast that it is actually MUI... however it does use dozens of variables which is not that good.... it also leaks ...

    So can't anyone help me here !?
    Can you guys help me with the order thingy ?
     
  8. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    Im too busy (lazy) for that for now
    also it may (does) require some dummies (planes and may be projectiles for size change)
    why dont you learn some vJass
     
  9. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    I know it does dummies and i know how and when to use them.

    Still, i do NOT need any dummies now !!!

    and i do NOT need vjass to make a single move call !!!

    For God sake read my post ! I don't acre about the spell, i just want to know, why my call "issueorder" is not working correctly !!!!! I just want to reduce some lag as well ...

    I don't need vjass for this !
    I just need help !

    Btw, when can i learn vjass ?
     
  10. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    diablo dk has a spell named orbital bombardmet I exemined it some to learn how to use timers
     
  11. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Hi guys !.
    Well as you already know I am making a fire bomb spell to post in the spell section. But I have a few troubles.

    it seems that the movement thing is not a problem.
    But I have Another one (or two soon).
    How do I fade my bomber, while it is moving ?
    Well to achieve this I use a loop... But problem is that everything stops when the code reaches it ! and I don't want that ...
    Code (vJASS):
    function Trig_Fire_Bomber_Conditions takes nothing returns boolean
        return GetSpellAbilityId() == 'A000'
    endfunction
    //===========================================================================
    function Trig_Fire_Bomber_Actions takes nothing returns nothing
        local unit bomber
        local unit bomb
        local player p = GetOwningPlayer(GetSpellAbilityUnit())
        local location m = GetSpellTargetLoc()          
        local real angle
        local integer transparency = 255
        call CreateNUnitsAtLoc( 1, 'h002', p, PolarProjectionBJ(m, -1000, AngleBetweenPoints(GetUnitLoc(GetTriggerUnit()), m)), bj_UNIT_FACING )
        set bomber = GetLastCreatedUnit()
        call SetUnitVertexColor(bomber, 255, 255, 255, 100)
        //where to put this loop ? or how to use it ?
        loop
            exitwhen transparency == 0
            call TriggerSleepAction(0.1)
            call SetUnitVertexColor(bomber, 255, 255, 255, 100 - transparency)
            set transparency = transparency - 5
        endloop
        //loop ends here
        set angle = AngleBetweenPoints(GetUnitLoc(bomber), m)
        call IssuePointOrderLoc( bomber, "move", PolarProjectionBJ(m, 1000.00, angle) )
        call RemoveLocation(m)
        set bomber = null
        set bomb = null
        set p = null
        set m = null
    endfunction

    //===========================================================================
    function InitTrig_Fire_Bomber takes nothing returns nothing
        set gg_trg_Fire_Bomber = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Bomber, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddCondition( gg_trg_Fire_Bomber, Condition( function Trig_Fire_Bomber_Conditions ) )
        call TriggerAddAction( gg_trg_Fire_Bomber, function Trig_Fire_Bomber_Actions )
    endfunction


    So question is, what do I do with the loop ? How do I change the color of my bomber without making it wait until it is visible ?

    I would like something like this:
    1 - unit is created invisible. (done)
    2 - Unit is ordered to move and it moves (done)
    3 - While it is moving it will become visible (Not done)

    But I have something like this:
    1 - unit is created invisible. (done)
    2 -We all wait unit it gets visible (bad)
    3 - The unit only moves after the loop (boring and bad)

    Can you guys help me solve this problem ? plz ?
     
  12. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    hmm lets see
    Code (vJASS):
    function FadeFunction takes nothing returns nothing
    local unit f = bj_lastCreatedUnit
    local integer fade = 0
    loop
    exitwhen fade == 10
    call SetUnitVertexColor(bomber, 255, 255, 255, 100 - transparency*10)
    call TriggerSleepAction(0.1)
    set fade=fade+1
    endloop
    endfunction
    function Trig_Fire_Bomber_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
    endfunction //===========================================================================
    function Trig_Fire_Bomber_Actions takes nothing returns nothing
    local unit bomber local unit bomb
    local player p = GetOwningPlayer(GetSpellAbilityUnit())
    local location m = GetSpellTargetLoc()
    local real angle
    local integer transparency = 255
    call CreateNUnitsAtLoc( 1, 'h002', p, PolarProjectionBJ(m, -1000, AngleBetweenPoints(GetUnitLoc(GetTriggerUnit()), m)), bj_UNIT_FACING )
    set bomber = GetLastCreatedUnit()
    call SetUnitVertexColor(bomber, 255, 255, 255, 100) //where to put this loop ? or how to use it ?
    set bj_lastCreatedUnit = bomber
    call ExecuteFunc("FadeFunction")
    set angle = AngleBetweenPoints(GetUnitLoc(bomber), m)
    call IssuePointOrderLoc( bomber, "move", PolarProjectionBJ(m, 1000.00, angle) )
    call RemoveLocation(m) set bomber = null
    set bomb = null set p = null set m = null
    endfunction //===========================================================================
    function InitTrig_Fire_Bomber takes nothing returns nothing
    set gg_trg_Fire_Bomber = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Fire_Bomber, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Fire_Bomber, Condition( function Trig_Fire_Bomber_Conditions ) )
    call TriggerAddAction( gg_trg_Fire_Bomber, function Trig_Fire_Bomber_Actions )
    endfunction


    AND THIS LEAKS MUUUUUUUUUUCCCCCCCCHHHHHHHHHH
     
  13. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    That seems useful and interesting, where can in find that spell ??
    However i can use waits instead of timers, they are less accurate and precise, but they are far easier to use and understand.

    EDIT

    Meh, I know it leaks like hell, but I am not worry about that rit now.
    WOW. Do you know what is stupid ?? Is that I tried that before and that didn't work ... but now it works ... what have you done dude !? LOL...

    Anyway thx. I will fix lags and stuff like that.

    Btw, great random spell pack you created =).




    EDIT

    MM, Hey I have two more questions. I know how timers are better then waits. IN a "wait" I can only have 0.1 as but in timers I can have 0.01
    How do I replace the wait in my loop by a nice timer ??

    (Well, I no longer need this, I figured a way out, but it would be nice if some1 could help me)

    Also, can't I use parameters in ExecuteFunc("......") ??? Because using GetLasCreatedUnit is a little bad, it makes my spell not MUI (I guess).

    Can you guys hep me out ?




    EDIT EDIT

    Hi, well, I have another problem. My code has grown and it is long now, so I just just put the parts of the code that are annoying me.

    Code (vJASS):

    function test takes integer getFade returns integer //this will set i to 100
        local integer i = getFade
        loop
            exitwhen (i == 100)
            call TriggerSleepAction(0.1)
            set i = i + 35  
        endloop
        return i  // return i which is equal to 100 ( I think)
    endfunction
    //===============================================
    function test2 takes integer getFade returns integer  // this will set i to 0
        local integer i = getFade
        loop
            exitwhen (i == 0)
            call TriggerSleepAction(0.1)
            set i = i - 35  
        endloop
        return i   //returns i which is 0 (I guess)
    endfunction
    //=============================================================
    function Trig_Fire_Bomber_Actions takes nothing returns nothing
        local integer fadeValue = 0  //dummy variable used to call other things
        //This loop waits until i (from test) is equal to 100 ( I think)
        loop
            exitwhen ( test(fadeValue) == 100)
            call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.1))
        endloop
       
        set fadeValue = 100  // because i = 100 ( I think) I have to set dummy var  to 100 too
        //this loop waits until i (from test2) is equal to 0 (I think)
        loop
            exitwhen ( test2(fadeValue) == 0)
            call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.1))
        endloop
        //When i = 0, (I think) I move on and kill some unit.
        call KillUnit(bomber)
    endfunction
     



    This should work ... but it doesn't ...
    Can you guys help me and tell me why ? plz ?
     
    Last edited: Jan 27, 2008
  14. HappyTauren

    HappyTauren

    Joined:
    Nov 3, 2006
    Messages:
    8,414
    Resources:
    87
    Models:
    61
    Icons:
    23
    Packs:
    1
    Tutorials:
    2
    Resources:
    87
    fire, you would need attachable and structs to do that properly (to use timers instead of wait). Wait is unacceptable in spells.
     
  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, I see. Anyway, I don't need the time now.

    and btw
    is a barbarity. Sure Timer are useful in some situations, even I have to agree with such.
    But waits are far more simple to use, and do exactly what timers do (not with such precision, but that is not a problem for me).

    I am trying hard to make this spell simple. Timers are out of question because waits are more simple to use and understand.

    STill thx for your comment.

    More suggestions about how to fix my code ? plz.
     
  16. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    it will be ok if you store variable execute func
    and store the global in a local in start of function
    it will be MUI because even GetLastCreatedUnit gets changed sometime
    it wont make problem because we stored it in a local and we use the local one
     
  17. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Mmm, I see. WyrmLord made a tutorial about that. I forgot that detail.

    Anyway, Can you tell me what is wrong in my wait for a condition ?? plz ?
     
  18. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    You shouldnt hate vJASS
    Most Efficent Reason >Quote: "Blizzard doesnt support world editor directly"
    I think they released it so quickly and didnt have time to improve
    so here comes NewGen WE and does the parts that blizzard didnt have time to do

    HappyTauren is extremly right about that
    Well if you want to learn how to use structs
    Best thing to do is exemine on Orbital Bombardment
    Great example for using timers with structs
     
  19. Flame_Phoenix

    Flame_Phoenix

    Joined:
    May 4, 2007
    Messages:
    2,283
    Resources:
    11
    Tools:
    1
    Maps:
    1
    Spells:
    6
    Tutorials:
    3
    Resources:
    11
    Ok, Thx for the advise. I will have a look on your code link soon.

    Btw, Can you plz tell me what is wrong in my code !? In the waiting for a condition ? plz ?
     
  20. Need_O2

    Need_O2

    Joined:
    Aug 24, 2007
    Messages:
    2,880
    Resources:
    0
    Resources:
    0
    i wont get 100
    you need to use >= and <=
    (greater or equal to)