• 🏆 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!

How to make a triggered Breath of Fire?

Status
Not open for further replies.
Remember that directly east is 0 and 360 degrees and west is 180.

If your unit is facing fx. 45 degrees and you want a 180 degree cone (half circle) then the right edge of the cone will be at 315 degree.

If that is the case and you pick every units between the left and right edge you will get the wrong half circle (or only units from 0 to 90 degrees. Can't remember).
In the example you will need to do the +360 degree trick.
 
Level 11
Joined
Oct 11, 2012
Messages
711
Remember that directly east is 0 and 360 degrees and west is 180.

If your unit is facing fx. 45 degrees and you want a 180 degree cone (half circle) then the right edge of the cone will be at 315 degree.

If that is the case and you pick every units between the left and right edge you will get the wrong half circle (or only units from 0 to 90 degrees. Can't remember).
In the example you will need to do the +360 degree trick.

Check the facing angle and use offset to pick the unit.

Thanks both of you. My math sucks, but I will try...
Which function to call BTW? >_< Add unit to group?
 
Determining a cone is quite more complex than circular or square checks...

@Solu9 - there's no such thing as a cone with 180 degree angle...

a normal way to go with cones is to use several points into the target angle such that you can check the expanding area of the cone...

I suggest you start first with doing straight line spells then once you've accustomed to it, move to cones... since the plane of the cone is basically, a straight line which has expanding width...
 
Level 11
Joined
Oct 11, 2012
Messages
711
Determining a cone is quite more complex than circular or square checks...

@Solu9 - there's no such thing as a cone with 180 degree angle...

a normal way to go with cones is to use several points into the target angle such that you can check the expanding area of the cone...

I suggest you start first with doing straight line spells then once you've accustomed to it, move to cones... since the plane of the cone is basically, a straight line which has expanding width...
Thanks for the reply. I finally figured out how to do it.
Thank you all.:ogre_haosis:
 
@Solu9 - there's no such thing as a cone with 180 degree angle...

You're right. But then again, the are not really any cones i WC3. They are all fans.

The example was made for easy explanation :)

Thanks for the reply. I finally figured out how to do it.

Great.
Can you post the trigger you use?
 
Last edited:
Level 11
Joined
Oct 11, 2012
Messages
711
You're right. But then again, the are not really any cones i WC3. They are all fans.

The example was made for easy explanation :)



Great.
Can you post the trigger you use?

Actually I use JASS, not GUI:
JASS:
function Trig_FS_Attack_Conditions takes nothing returns boolean
    return(GetSpellAbilityId()=='A004')
endfunction

function Trig_FS_Attack_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local real casterX = GetUnitX(caster)
    local real casterY = GetUnitY(caster)
    local unit starget = GetSpellTargetUnit()
    local real stargetX = GetUnitX(starget)
    local real stargetY = GetUnitY(starget)
    local unit u 
    local real uX 
    local real uY
    local real a = bj_RADTODEG * Atan2(stargetY - casterY, stargetX -casterX)
    local real b = 60.00
    local real c  
    local group g = CreateGroup()
    local real facing = GetUnitFacing(caster)
    local integer p = GetPlayerId(GetTriggerPlayer())
    local unit dum
    call GroupEnumUnitsInRange( g, casterX, casterY, 800.00,null) 
    set u = FirstOfGroup(g)
    //Create Effect Starts
    set dum = CreateUnit(Player(p),'h006',casterX,casterY,facing)
    call UnitApplyTimedLife(dum,'BHwe',1.)
    call IssueTargetOrderById(dum,852580,starget)
    //Create Effect Ends
    loop
        exitwhen u == null
        set u = FirstOfGroup(g)
        set uX = GetUnitX(u) 
        set uY = GetUnitY(u)
        set c = bj_RADTODEG * Atan2(uY - casterY, uX -casterX) 
        if CosBJ(( a- c )) > CosBJ(b) then
            if IsUnitEnemy(u, Player(p)) and GetWidgetLife(u) > 0.405 then
                call UnitDamageTarget(caster,u,8,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_DEMOLITION,null)
                call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\Banish\\BanishTarget.mdl",u,"overhead"))
            endif
        endif
        call GroupRemoveUnit(g,u)
    endloop
    set caster = null
    set starget = null
    set g = null
    set dum = null
endfunction

function InitTrig_FS_Attack takes nothing returns nothing
    set gg_trg_FS_Attack=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_FS_Attack,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_FS_Attack,Condition(function Trig_FS_Attack_Conditions))
    call TriggerAddAction(gg_trg_FS_Attack,function Trig_FS_Attack_Actions)
endfunction
 
Status
Not open for further replies.
Top