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

[GUI] Spirit of Fire v1.5

229063-albums7387-picture84943.png

The Blood Mage calls the Spirit of Fire in a target point which can breath a fire and spin in 360 angle.

Triggers
    • SoF Setup
      • Events
        • Map initialization
      • Conditions
      • Actions
        • -------- ======================== --------
        • -------- S P I R I T O F F I R E --------
        • -------- By: GywGod133 --------
        • -------- ======================== --------
        • -------- > Spell Function --------
        • -------- - Config Ability --------
        • Set SoF_Ability = Spirit of Fire
        • -------- - Data - Spirit of Fire (Dummy) Duration --------
        • Set SoF_Duration[1] = 5.00
        • Set SoF_Duration[2] = 6.00
        • Set SoF_Duration[3] = 7.00
        • -------- - Data - SFX --------
        • Set SoF_SpecialEffect = Abilities\Spells\Other\Doom\DoomDeath.mdl
        • Set SoF_SpecialEffect2 = Abilities\Spells\Human\FlameStrike\FlameStrikeTarget.mdl
        • -------- - Data - Spin Speed --------
        • -------- Note: Sometimes, the higher speed is not compatible --------
        • -------- Min: 0 / Max: 360 --------
        • Set SoF_SpinSpeed = 5.00
        • -------- - Data - Animation --------
        • Set SoF_Animation = channel
        • Set SoF_Animation2 = death
        • -------- ======================== --------
        • -------- > Dummy Function --------
        • -------- - Main Spell --------
        • Set SoF_DummyAbility = BoF (Neutral Hostile)
        • -------- - Red Ball --------
        • Set SoF_DummyTypeA = Fire Spirit
        • -------- - Red Ball Duration --------
        • Set SoF_SpiritDuration = 2.00
        • -------- - Caster --------
        • Set SoF_DummyTypeB = SoF (Caster)
        • -------- ======================== --------
        • -------- Periodic --------
        • -------- NOTE: This function it helps you to give a exact duration --------
        • Custom script: set udg_SoF_Loop = 0.03125
        • Trigger - Add to SoF Loop <gen> the event (Time - Every SoF_Loop seconds of game time)
        • -------- ======================== --------
        • -------- Destroy This Trigger: --------
        • Custom script: call DestroyTrigger( GetTriggeringTrigger())
        • -------- ======================== --------
    • SoF Start
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to SoF_Ability
      • Actions
        • -------- ======================== --------
        • -------- Turn On Trigger Loop --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • SoF_Y Equal to 0
          • Then - Actions
            • Trigger - Turn on SoF Loop <gen>
          • Else - Actions
        • -------- ======================== --------
        • -------- Indexing Function: --------
        • Set SoF_Y = (SoF_Y + 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • SoF_Y Greater than SoF_Y_maxSize
          • Then - Actions
            • Set SoF_Y_Index[SoF_Y] = SoF_Y
            • Set SoF_Y_maxSize = SoF_Y
          • Else - Actions
        • Set SoF_TempInt = SoF_Y_Index[SoF_Y]
        • -------- ======================== --------
        • -------- Saving Data Function --------
        • -------- > Save Caster --------
        • Set SoF_Caster[SoF_TempInt] = (Triggering unit)
        • -------- > Save Player --------
        • Set SoF_Player[SoF_TempInt] = (Triggering player)
        • -------- > Save Ability Level --------
        • Set SoF_Level[SoF_TempInt] = (Level of SoF_Ability for SoF_Caster[SoF_TempInt])
        • -------- > Save Duration --------
        • Set SoF_Duration_Real[SoF_TempInt] = SoF_Duration[SoF_Level[SoF_TempInt]]
        • -------- ======================== --------
        • -------- Spirit Function --------
        • -------- > Spirit Created --------
        • Set SoF_TempLoc = (Target point of ability being cast)
        • Unit - Create 1 SoF_DummyTypeA for SoF_Player[SoF_TempInt] at SoF_TempLoc facing (Random angle) degrees
        • -------- > Save Spirit --------
        • Set SoF_Spirit[SoF_TempInt] = (Last created unit)
        • Animation - Play SoF_Spirit[SoF_TempInt]'s SoF_Animation animation, using only Rare animations
        • -------- > Save Spirit's Angle --------
        • Set SoF_SpiritAngle[SoF_TempInt] = (Facing of SoF_Spirit[SoF_TempInt])
        • -------- > Save SFX --------
        • Set SoF_TempLoc2 = (Position of SoF_Spirit[SoF_TempInt])
        • Special Effect - Create a special effect at SoF_TempLoc2 using SoF_SpecialEffect2
        • Set SoF_SFXCreated[SoF_TempInt] = (Last created special effect)
        • -------- ======================== --------
        • -------- Dummy Caster --------
        • Set SoF_TempLoc3 = (Position of SoF_Spirit[SoF_TempInt])
        • Unit - Create 1 SoF_DummyTypeB for SoF_Player[SoF_TempInt] at SoF_TempLoc3 facing Default building facing degrees
        • Set SoF_DummyCaster[SoF_TempInt] = (Last created unit)
        • Unit - Add SoF_DummyAbility to SoF_DummyCaster[SoF_TempInt]
        • Unit - Set level of SoF_DummyAbility for SoF_DummyCaster[SoF_TempInt] to SoF_Level[SoF_TempInt]
        • -------- ======================== --------
        • -------- Remove Leak --------
        • Custom script: call RemoveLocation( udg_SoF_TempLoc)
        • Custom script: call RemoveLocation( udg_SoF_TempLoc2)
        • Custom script: call RemoveLocation( udg_SoF_TempLoc3)
        • -------- ======================== --------
    • SoF Loop
      • Events
      • Conditions
      • Actions
        • -------- ============================================================== --------
        • -------- PLEASE DO NOT MODIFY UNLESS YOU KNOW WHAT YOU ARE DOING!! --------
        • -------- ============================================================== --------
        • For each (Integer SoF_X) from 1 to SoF_Y, do (Actions)
          • Loop - Actions
            • -------- ======================== --------
            • Set SoF_TempInt = SoF_Y_Index[SoF_X]
            • -------- ======================== --------
            • -------- Duration Function: --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • SoF_Duration_Real[SoF_TempInt] Less than or equal to 0.00
              • Then - Actions
                • -------- ======================== --------
                • -------- Finished Spell --------
                • Animation - Reset SoF_Spirit[SoF_TempInt]'s animation
                • Animation - Play SoF_Spirit[SoF_TempInt]'s SoF_Animation2 animation, using only Rare animations
                • Special Effect - Destroy SoF_SFXCreated[SoF_TempInt]
                • Unit - Add a SoF_SpiritDuration second Generic expiration timer to SoF_Spirit[SoF_TempInt]
                • Unit - Add a SoF_SpiritDuration second Generic expiration timer to SoF_DummyCaster[SoF_TempInt]
                • -------- ======================== --------
                • -------- RecycleIndex --------
                • Set SoF_Spirit[SoF_TempInt] = No unit
                • Set SoF_DummyCaster[SoF_TempInt] = No unit
                • Set SoF_Y_Index[SoF_X] = SoF_Y_Index[SoF_Y]
                • Set SoF_Y_Index[SoF_Y] = SoF_TempInt
                • Set SoF_Y = (SoF_Y - 1)
                • Set SoF_X = (SoF_X - 1)
                • -------- ======================== --------
                • -------- Turn Off This Trigger if not needed --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • SoF_Y Equal to 0
                  • Then - Actions
                    • Trigger - Turn off (This trigger)
                    • Skip remaining actions
                  • Else - Actions
                • -------- ======================== --------
              • Else - Actions
                • -------- ======================== --------
                • -------- Duration Function: --------
                • -------- Decrease your duration in 0.03125 sec --------
                • Set SoF_Duration_Real[SoF_TempInt] = (SoF_Duration_Real[SoF_TempInt] - SoF_Loop)
                • -------- ======================== --------
                • -------- Fire Ball Spin Function: --------
                • -------- > Angle Adjustment: --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Or - Any (Conditions) are true
                      • Conditions
                        • SoF_SpiritAngle[SoF_TempInt] Less than or equal to 0.00
                        • SoF_SpiritAngle[SoF_TempInt] Greater than or equal to 360.00
                  • Then - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • SoF_SpiritAngle[SoF_TempInt] Equal to 0.00
                      • Then - Actions
                        • Set SoF_SpiritAngle[SoF_TempInt] = SoF_SpinSpeed
                      • Else - Actions
                        • Set SoF_SpiritAngle[SoF_TempInt] = 0.00
                  • Else - Actions
                • -------- > Angle --------
                • Set SoF_SpiritAngle[SoF_TempInt] = (SoF_SpiritAngle[SoF_TempInt] + SoF_SpinSpeed)
                • -------- > Facing SoF_FireBallAngle[SoF_X] --------
                • Set SoF_TempLoc = (Position of SoF_Spirit[SoF_TempInt])
                • Unit - Move SoF_Spirit[SoF_TempInt] instantly to SoF_TempLoc, facing SoF_SpiritAngle[SoF_TempInt] degrees
                • -------- ======================== --------
                • -------- Fire Breath Function: --------
                • Set SoF_TempLoc2 = (Position of SoF_DummyCaster[SoF_TempInt])
                • Set SoF_TempLoc3 = ((Position of SoF_DummyCaster[SoF_TempInt]) offset by 100.00 towards SoF_SpiritAngle[SoF_TempInt] degrees)
                • Unit - Move SoF_DummyCaster[SoF_TempInt] instantly to SoF_TempLoc2
                • Unit - Order SoF_DummyCaster[SoF_TempInt] to Neutral Pandaren Brewmaster - Breath Of Fire SoF_TempLoc3
                • -------- ======================== --------
                • -------- Remove Leak --------
                • Custom script: call RemoveLocation( udg_SoF_TempLoc)
                • Custom script: call RemoveLocation( udg_SoF_TempLoc2)
                • Custom script: call RemoveLocation( udg_SoF_TempLoc3)
                • -------- ======================== --------
    • SoF Dummy
      • Events
        • Unit - A unit Dies
      • Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • (Unit-type of (Triggering unit)) Equal to SoF_DummyTypeA
            • (Unit-type of (Triggering unit)) Equal to SoF_DummyTypeB
      • Actions
        • -------- ======================== --------
        • -------- Removing Dummy Function: --------
        • -------- ======================== --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Triggering unit)) Equal to SoF_DummyTypeA
          • Then - Actions
            • -------- ======================== --------
            • -------- Spirit of Fire Effect: --------
            • Set SoF_TempLoc3 = (Position of (Triggering unit))
            • Special Effect - Create a special effect at SoF_TempLoc3 using SoF_SpecialEffect
            • Special Effect - Destroy (Last created special effect)
            • -------- ======================== --------
          • Else - Actions
        • -------- ======================== --------
        • -------- Remove Dummy --------
        • Unit - Remove (Triggering unit) from the game
        • -------- ======================== --------
        • -------- Remove Leak --------
        • Custom script: call RemoveLocation( udg_SoF_TempLoc3)
        • -------- ======================== --------
Credits
Vexorian for Dummy.mdx
PeeKay for BTNWarCry
Keywords:
Fire Spell, GywGod133
Contents

[Spell] Spirit of Fire (Map)

Reviews
11:52, 14th Jun 2014 BPower: When you check your spell carefully, you will realise that the location variable SoF_TempLoc3 is not required. You could handle everything with two location variables. SoF_Level still shouldn't be an array, but a non...

Moderator

M

Moderator

11:52, 14th Jun 2014
BPower:
  • When you check your spell carefully, you will realise that the location variable SoF_TempLoc3 is not required. You could handle everything with two location variables.
  • SoF_Level still shouldn't be an array, but a non array variable.
  • You don't have to remove the dummy unit. It's already set to "Does not decay, can't raise".
  • I like the concept, however it's not really complicated to code by oneself. I'll rate it with useful
Approved

16:15, 12th Jun 2014
BPower:
Set to Need Fix until changes are made.

22:54, 10th Jun 2014
BPower:
Check out my last post. This is soon ready for approval.

09:01, 4th May 2014
BPower:
Refer to my last post.
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
There is no benefit in destroying the map init trigger.

SoF_Start:

Hanky's indexing template is totally fine. I recommend you take a look into this, just to be aware of an alternative way of indexing.
The one I posted is also faster to type on the keyboard (less lines of code).

SoF_AoePoint is equal to Sof_TempPoint, remove one of them from your code. Here is also a location leak.
SoF_TempPoint_Copy is not even used, remove it. Furthermore "Copy" is not a good name for a variable.
Btw for the whole script you only need 1 non array location variable.

Loop:

You don't have to null player variables, as they are constant handles. We don't expect it in GUI code, but you can null the effect variable SoF_SFX.

You should use one dummy caster per spell instance or just one for the whole game season. Currently you create one each 0.03 seconds, which causes a huge amount of extra computation time.
You can ask for help if you don't know how to achieve this.

The rotation speed should be configurable for the user.
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
Towards your question:

1. You create one unit variable in the variable editor
2. In your init trigger you create one dummy caster and set it to this variable.
3. Add the dummy ability to the unit, it has to have 0 cooldown and no manacost
4. In the loop you move the dummy caster unit to the desired point, change ownership to the owner of the casting unit and order the dummy ability.
5. Due to 0 cd and 0 manacost you can order the ability all the time.

That's it.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
There is no benefit in destroying the map init trigger.

Removing old unused triggers is actually beneficial as it releases unused memory. If any events are added it also destroys them and releases the memory from them. It also takes triggers with events that can repeat out of the queue causing a small speed increase.

Releasing all unused triggers can make a map last longer if that map has a chance of hitting the memory limit for WC3. ( Around 1.85gb)
 
Last edited:
Level 19
Joined
Mar 18, 2012
Messages
1,716
Good way to use a dummy caster:
  • Example
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Needs ability locust and should use the model file dummy.mdx --------
      • Custom script: set udg_DummyCaster = CreateUnit(Player(15), udg_DummyCasterId, 0,0,0)
  • Loop
    • Events
    • Conditions
    • Actions
      • -------- Actions before --------
      • Unit - Move DummyCaster instantly to MyPoint
      • -------- Owner of caster may be stored in a player variable. --------
      • Unit - Change ownership of DummyCaster to (Owner of (Triggering unit)) and Retain color
      • Unit - Order DummyCaster to Human Mountain King - Storm Bolt (Picked unit)
      • -------- Owner of caster may be stored in a player variable. --------
      • Unit - Change ownership of DummyCaster to Neutral Passive and Retain color
      • -------- Actions after --------
 

Deleted member 219079

D

Deleted member 219079

What kind of indexing you use?
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
  • Custom script: set udg_SoF_Real[ udg_SoF_TempInt] = (udg_SoF_Real[ udg_SoF_TempInt] - 0.03125)
Instead of 0.03125 you should use udg_SoF_Loop

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • SoF_FireBallAngle[SoF_TempInt] Equal to 0.00
          • SoF_FireBallAngle[SoF_TempInt] Equal to 360.00
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SoF_FireBallAngle[SoF_TempInt] Equal to 0.00
        • Then - Actions
          • Set SoF_FireBallAngle[SoF_TempInt] = SoF_SpinSpeed
        • Else - Actions
          • Set SoF_FireBallAngle[SoF_TempInt] = 0.00
    • Else - Actions
Here is a problem, it should be less or equal and greater than or equal, because if the periodic spin value isn't a divider of 360 it doesn't work the way you have it now.

Apart from that it's ok.
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
SoF_Level doesn't have to be an array and fix the other two things I mentioned.
I just saw you have a location leak in the SoF Dummy trigger.
Furthermore there is a location leak in SoF Start trigger, when creating the special effect.
In this trigger you could store "TriggeringUnit" into a variable.
 
Top