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,515
  • Enflame.w3x
    47.6 KB · Views: 573

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.
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top