Spell Enflame

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Enflame

Spell_Fire_Incinerate.png


Created by Darthfett
Fire Spell
Passive

Screenshot:
attachment.php


Description:
Gives the Hero a 5%/10%/15% chance to enflame upon attacking,
releasing a fury of firebolts from him, dealing 60 damage to nearby units.

-MPI
-MUI
-Leak-less
-Lag-less

-Created in GUI



Trigger:
  • Enflame
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Enflame for (Attacking unit)) Greater than 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to ((Level of Enflame for (Attacking unit)) x 5)
        • Then - Actions
          • Set TEMP_Point1 = (Position of (Attacking unit))
          • Sound - Play Enflame <gen> at 100.00% volume, attached to (Attacking unit)
          • Special Effect - Create a special effect attached to the origin of (Attacking unit) using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
          • Special Effect - Destroy (Last created special effect)
          • For each (Integer A) from 1 to 8, do (Actions)
            • Loop - Actions
              • Set TEMP_Real = (45.00 x (Real((Integer A))))
              • Set TEMP_Point2 = (TEMP_Point1 offset by 16.00 towards TEMP_Real degrees)
              • Set TEMP_Point3 = (TEMP_Point1 offset by 200.00 towards TEMP_Real degrees)
              • Unit - Create 1 Enflame Dummy (Ability) for (Owner of (Attacking unit)) at TEMP_Point2 facing TEMP_Real degrees
              • Unit - Set level of Enflame (Dummy) for (Last created unit) to (Level of Enflame for (Attacking unit))
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Neutral Tinker - Cluster Rockets TEMP_Point3
              • Custom script: call RemoveLocation (udg_TEMP_Point2)
              • Custom script: call RemoveLocation (udg_TEMP_Point3)
          • Set TEMP_Group = (Units within 400.00 of TEMP_Point1 matching (((Owner of (Matching unit)) is an enemy of (Owner of (Attacking unit))) Equal to True))
          • Unit Group - Pick every unit in TEMP_Group and do (Actions)
            • Loop - Actions
              • Unit - Cause (Attacking unit) to damage (Picked unit), dealing 60.00 damage of attack type Spells and damage type Fire
          • Custom script: call DestroyGroup(udg_TEMP_Group)
          • Custom script: call RemoveLocation (udg_TEMP_Point1)
        • Else - Actions
 

Attachments

  • Enflame Screenie2.JPG
    Enflame Screenie2.JPG
    43.2 KB · Views: 1,517
  • Enflame.w3x
    47.6 KB · Views: 578

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
PurgeandFire said:
You forgot to destroy the group. Else, good job on the coding and visual effects.

Custom script: set bj_wantDestroyGroup = true

It's supposed to automatically destroy it, part of the ForGroupBJ function:

Code:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction
 

vypur85

Hibernate
Reaction score
803
Code:
Set TEMP_Group = (Units within 400.00 of TEMP_Point1 matching (((Owner of (Matching unit)) is an enemy of (Owner of (Attacking unit))) Equal to True))
Isn't it considered as a leak since you set the unit group? Not sure myself.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Code:
Set TEMP_Group = (Units within 400.00 of TEMP_Point1 matching (((Owner of (Matching unit)) is an enemy of (Owner of (Attacking unit))) Equal to True))
Isn't it considered as a leak since you set the unit group? Not sure myself.

That was the reason I set the group, so I could destroy it and remove the leak :p
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
If your going set the group to a variable then use call DestroyGroup.

The function does it.

Code:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        [B]call DestroyGroup(whichGroup)[/B]
    endif
endfunction
 

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
The function does it.

Erm, no, it doesn't. It leaks.

I never said it leaks but your better off not setting it to a variable or use call destroy. Its faster.
The two options:
Code:
                Set TEMP_Group = (Units within 400.00 of TEMP_Point1 matching (((Owner of (Matching unit)) is an enemy of (Owner of (Attacking unit))) Equal to True))
                Unit Group - Pick every unit in TEMP_Group and do (Actions)
                    Loop - Actions
                        Unit - Cause (Attacking unit) to damage (Picked unit), dealing 60.00 damage of attack type Spells and damage type Fire
                Custom script:   call RemoveLocation (udg_TEMP_Point1)
                Custom script:   call DestroyGroup (udg_TEMP_Group)
            Else - Actions
Code:
                Custom script:   set bj_wantDestroyGroup = true
                Unit Group - Pick every unit (Units within 400.00 of TEMP_Point1 matching (((Owner of (Matching unit)) is an enemy of (Owner of (Attacking unit))) Equal to True)) and do (Actions)
                    Loop - Actions
                        Unit - Cause (Attacking unit) to damage (Picked unit), dealing 60.00 damage of attack type Spells and damage type Fire
                Custom script:   call RemoveLocation (udg_TEMP_Point1)
            Else - Actions
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Yes it does...

Here is the Converted JASS of the function.

Code:
function Trig_Enflame_Conditions takes nothing returns boolean
    if ( not ( GetUnitAbilityLevelSwapped('A001', GetAttacker()) > 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Enflame_Func001Func008002003 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetAttacker())) == true )
endfunction

function Trig_Enflame_Func001Func010A takes nothing returns nothing
    call UnitDamageTargetBJ( GetAttacker(), GetEnumUnit(), 60.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE )
endfunction

function Trig_Enflame_Func001C takes nothing returns boolean
    if ( not ( GetRandomInt(1, 100) <= ( GetUnitAbilityLevelSwapped('A001', GetAttacker()) * 5 ) ) ) then
        return false
    endif
    return true
endfunction

function Trig_Enflame_Actions takes nothing returns nothing
    if ( Trig_Enflame_Func001C() ) then
        set udg_TEMP_Point1 = GetUnitLoc(GetAttacker())
        call PlaySoundOnUnitBJ( gg_snd_Enflame, 100, GetAttacker() )
        call AddSpecialEffectTargetUnitBJ( "origin", GetAttacker(), "Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl" )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        set bj_forLoopAIndex = 1
        set bj_forLoopAIndexEnd = 8
        loop
            exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
            set udg_TEMP_Real = ( 45.00 * I2R(GetForLoopIndexA()) )
            set udg_TEMP_Point2 = PolarProjectionBJ(udg_TEMP_Point1, 16.00, udg_TEMP_Real)
            set udg_TEMP_Point3 = PolarProjectionBJ(udg_TEMP_Point1, 200.00, udg_TEMP_Real)
            call CreateNUnitsAtLoc( 1, 'n000', GetOwningPlayer(GetAttacker()), udg_TEMP_Point2, udg_TEMP_Real )
            call SetUnitAbilityLevelSwapped( 'A000', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped('A001', GetAttacker()) )
            call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
            call IssuePointOrderLocBJ( GetLastCreatedUnit(), "clusterrockets", udg_TEMP_Point3 )
            call RemoveLocation (udg_TEMP_Point2)
            call RemoveLocation (udg_TEMP_Point3)
            set bj_forLoopAIndex = bj_forLoopAIndex + 1
        endloop
        call RemoveLocation (udg_TEMP_Point1)
        set udg_TEMP_Point1 = GetUnitLoc(GetAttacker())
        set udg_TEMP_Group = GetUnitsInRangeOfLocMatching(400.00, udg_TEMP_Point1, Condition(function Trig_Enflame_Func001Func008002003))
        [B]set bj_wantDestroyGroup = true
        call ForGroupBJ( udg_TEMP_Group, function Trig_Enflame_Func001Func010A )[/B]
        call RemoveLocation (udg_TEMP_Point1)
    else
    endif
endfunction

//===========================================================================
function InitTrig_Enflame takes nothing returns nothing
    set gg_trg_Enflame = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Enflame, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_Enflame, Condition( function Trig_Enflame_Conditions ) )
    call TriggerAddAction( gg_trg_Enflame, function Trig_Enflame_Actions )
endfunction

As you can see, the pick every unit in unit group is run by the ForGroupBJ function:

Code:
call ForGroupBJ( udg_TEMP_Group, function Trig_Enflame_Func001Func010A )

Code:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    [B]local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false[/B]

    call ForGroup(whichGroup, callback)

    [B]// If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)[/B]
    endif
endfunction

The function then runs the callback, and since I set the bj_wantDestroyGroup to true just before running the Pick every units..., it is destroyed.

However, this method of destroying a group only works when it uses the ForGroupBJ function, since it has the preference embedded in the function.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
I see that quite a few things have changed in the mapping world since I left and came back.

http://www.thehelper.net/forums/showthread.php?t=84524&highlight=destroy

I've always thought you had to set the variable, and use the set bj_wantDestroyGroup = true

I guess not, thanks. Working on it now.

(I did make this ability for myself originally, before I temporarily quit mapping. That's one of the reasons some things are not that great).
 

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
I see that quite a few things have changed in the mapping world since I left and came back.

http://www.thehelper.net/forums/showthread.php?t=84524&highlight=destroy

I've always though you had to set the variable, and use the set bj_wantDestroyGroup = true

I guess not, thanks. Working on it now.

Don't worry about it. Just trying to help a fellow coming back to moding and mapping.

Edit:(Attacking unit) should be set to a variable because every time you use that it has to do the event response thing which is slower and inefficient.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Yeah. You can either use bj_wantDestroyGroup or just destroy it manually.

If you use a global variable, it does still destroy it. As long as you use the global variable as the argument.

I didn't see any bj_wantDestroy when I first looked at the code. Sorry. :D
 

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
Yeah. You can either use bj_wantDestroyGroup or just destroy it manually.

If you use a global variable, it does still destroy it. As long as you use the global variable as the argument.

I didn't see any bj_wantDestroy when I first looked at the code. Sorry. :D

Thats cause it has been changed and why you don't understand what we talking about.
 
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

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top