Spell Pestilence

Immolation

Member
Reaction score
20
Pestilence​
Conjures several pestilential clouds that move to the target point and damage units that touch them.

GUI
/vJASS= vJASS
Leakless?= Yes(I hope).
Lagless= Yes.
MUI/MPI?= MUI

Changelog:
v1.2a
-Fixed spacing.

v1.2
-Updated code.
-Removed not needed triggers.

v1.1a
-Updated code.

v1.1:
-Replaced all locations with coordinates.
-Uses natives only now :D

v1.00:
-Initial release.


Code:
JASS:
scope Pestilence initializer Init
//-------------------------------------------------------------
//                  Pestilence by Immolation                
//-------------------------------------------------------------

// Description:
//---------------------------
// Calls forth pestilential clouds causing damage to struck enemies.

// What do I need to import it in my map?
//---------------------------
// You need to download JASS NewGen, available at the following links:

// -http://www.thehelper.net/forums/showthread.php?t=73936-
// -http://www.wc3c.net/showthread.php?t=90999-

//Install it and then read the following paragraph.

// How do I put it in my map?
//---------------------------
// 1. Copy:
//  a. The "Pestilence" ability.
//  b. The "Pestilence(Wave)" ability.
//  c. Export the "dummy.mdx" file and import it back into your map.
//  d. Copy the "Dummy Unit" into your map.
//  e. Copy this trigger.
// 2. Press CTRL + D while in Abilities section in Object Editor to find out the rawcode of:
//  a. The "Pestilence" ability. Change the SPELL_ID to the rawcode that you find(it's 'A000' in this map).
//  b. The "Pestilence(Wave)" ability. Change the DUMMY_SPELL_ID to the rawcode that you find(it's 'A001' in this map).
//  c. The "Dummy Unit" unit. Change the DUMMY_UNITID to the rawcode that you find(it's 'n000' in this map).
// 3. You have succesfully imported the spell <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />

// Changelog:
//---------------------------
// v1.2a:
// -Fixed spacing.
//
// v1.2:
// -Updated code.
// -Removed not needed triggers.
//
// v1.1a:
// -Updated code.
//
// v1.1:
// -Replaced all locations with coordinates.
// -Uses natives only now <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />
//
// v1.00:
//  -Initial release.
//---------------------------
// TheHelper.net

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//                             LIST OF CONFIGURABLES
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//About Configurables:
// You can configure most of the spell in the object editor, but for amount of rays called
//  and the rawcode of the abilities(and the dummy unit) check the map header.

    globals
        private constant integer SPELL_ID = &#039;A000&#039; //Rawcode of the &quot;Pestilence&quot; ability.
        private constant integer DUMMY_SPELLID = &#039;A001&#039; //Rawcode of the &quot;Pestilence(Wave)&quot; ability.
        private constant integer DUMMY_UNITID = &#039;n000&#039; //Rawcode of the &quot;Dummy Unit&quot;.
        private constant real DUMMY_DURATION = 5.00 //Duration of dummy unit.    
        private constant real DUMMY_HEIGHT = 100.00 //Height of dummy unit.
        private constant real WAVES_DEGREE = 5.00 //Degree difference between each wave.
                                            //A number between 24 and 5 is suggested.
                                            //Note however that 24 creates a perfect circle.
        private constant integer WAVES_PER_LEVEL = 1 //Additional waves gained for each level of the spell.
        private constant integer WAVES_BASE = 0 //Standard amount of waves; without counting the spell level.
    endglobals

//Regarding Waves:
// Each wave counts as 2 waves since the spell is symmetrical.
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

    private function Cond takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ID
    endfunction

    private function Main takes nothing returns nothing
        local unit caster = GetTriggerUnit()
        local player p = GetOwningPlayer(caster)
        local real x = GetUnitX(caster)
        local real y = GetUnitY(caster)
        local real degree = GetUnitFacing(caster)
        local real x2 = x + 100.00 * Cos(degree * bj_DEGTORAD)
        local real y2 = y + 100.00 * Sin(degree * bj_DEGTORAD)
        local integer level = GetUnitAbilityLevel(caster, SPELL_ID)
        local integer start = 1
        local integer end = ((WAVES_PER_LEVEL * level) + WAVES_BASE)
        local unit dummy = CreateUnit(p, DUMMY_UNITID, x, y, 0)
        call UnitAddAbility(dummy, DUMMY_SPELLID)
        call SetUnitFlyHeight(dummy, DUMMY_HEIGHT, 0)
        call UnitApplyTimedLife(dummy, &#039;BTLF&#039;, DUMMY_DURATION)
        call IssuePointOrder(dummy, &quot;carrionswarm&quot;, x2, y2)
        loop
            exitwhen start &gt; end
            set degree = (degree + WAVES_DEGREE)
            set x2 = x + 100.00 * Cos(degree * bj_DEGTORAD)
            set y2 = y + 100.00 * Sin(degree * bj_DEGTORAD)
            set dummy = CreateUnit(p, DUMMY_UNITID, x, y, 0)
            call UnitAddAbility(dummy, DUMMY_SPELLID)
            call SetUnitFlyHeight(dummy, DUMMY_HEIGHT, 0)
            call UnitApplyTimedLife(dummy, &#039;BTLF&#039;, DUMMY_DURATION)
            call IssuePointOrder(dummy, &quot;carrionswarm&quot;, x2, y2)
            set start = start + 1
        endloop
        set degree = GetUnitFacing(GetTriggerUnit())
        set start = 1
        set end = ((WAVES_PER_LEVEL * level) + WAVES_BASE)
        loop
            exitwhen start &gt; end
            set degree = (degree - WAVES_DEGREE)
            set x2 = x + 100.00 * Cos(degree * bj_DEGTORAD)
            set y2 = y + 100.00 * Sin(degree * bj_DEGTORAD)
            set dummy = CreateUnit(p, DUMMY_UNITID, x, y, 0)
            call UnitAddAbility(dummy, DUMMY_SPELLID)
            call SetUnitFlyHeight(dummy, DUMMY_HEIGHT, 0)
            call UnitApplyTimedLife(dummy, &#039;BTLF&#039;, DUMMY_DURATION)
            call IssuePointOrder(dummy, &quot;carrionswarm&quot;, x2, y2)
            set start = start + 1
        endloop
        set caster = null
        set dummy = null
    endfunction

//===========================================================================
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Condition(function Cond))
        call TriggerAddAction(t, function Main)
    endfunction
endscope




I feel bad for those poor turtles ç_ç


Comment and rate :eek:
 

Attachments

  • Pestilence v1.2a.w3x
    53.1 KB · Views: 227

_whelp

New Member
Reaction score
54
Why did you need vJass for the spell? It doesn't really use structs or attach to anything, but it makes it a bit neater.

Good spell nonetheless.
 

wraithseeker

Tired.
Reaction score
122
Because we use JNPG and vJASS has globals for us and scopes.

You should convert those PolarProjectionBJ and use the functions inside the BJ instead.
 

Viikuna

No Marlo no game.
Reaction score
265
vJass is needed. This would suck terribly, if it didnt use vJass features, such as scope and global block.

edit. lols wraithseeker was faster..
 
Reaction score
456
You can give initial value of CreateTrigger() to variable t in Init function.

Replace all your locations with coordinates.
 

Immolation

Member
Reaction score
20
Updated!

v1.1
-Replaced all locations with coordinates.
-Uses natives only now ;)

What does this need to get approved?
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
> What does this need to get approved?
Time.
 
Reaction score
91
Ugh...


Becomes:


This BJ, for once, is one of the most useful.

JASS:

    local real x = GetLocationX(GetUnitLoc(caster))

GetUnitLoc(caster) leaks - store it in a variable and use it wherever needed. Actually, it's better to just use GetUnitX()/GetUnitY() and not worry about location removal and such.

JASS:

    local unit caster = GetTriggerUnit()
    local unit dummy

Those things need nulling at the end of the trigger, otherwise they'll leak memory.

Other than that, it seems fine I guess, though it's a little basic. ;)
 

Immolation

Member
Reaction score
20
@Tyrande: Thanks for the help.
Regarding the "pretty basic" thing:
I think that simple and not overdone spells are much better than extremely complex, with lots of eye-candy spells.

And since I'm still pretty newb at vJASSing, I just make simple spells(check out God's Hand too if you wish.)

@simonake: Those are not units, are simple effects spawned through the Pestilence(Wave) ability. It is based off Carrion Swarm.

@MagnaGuard: I don't import anything except the dummy.mdx file and that could be useful for other spells that use dummy units. And if that "How to import" paragraph seems too long, it's just because people without enough experience can port it to their map.

Thanks for all the comments and help so far ;)

P.S.: Updated with the changes suggested by Tyrande.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Really;
No one caught this:
JASS:
// How do I put it in my map?
//---------------------------
// 1. Copy:
//  a. The &quot;Pestilence&quot; ability.
//  b. The &quot;Pestilence(Wave)&quot; ability.
//  c. Export the &quot;dummy.mdx&quot; file and import it back into your map.
//  d. Copy the &quot;Dummy Unit&quot; into your map.
//  e. Copy this trigger.
// 3. Press CTRL + D while in Abilities section in Object Editor to find out the rawcode of:
//  a. The &quot;Pestilence&quot; ability. Change the SPELL_ID to the rawcode that you find(it&#039;s &#039;A000&#039; in this map).
//  b. The &quot;Pestilence(Wave)&quot; ability. Change the DUMMY_SPELL_ID to the rawcode that you find(it&#039;s &#039;A001&#039; in this map).
//  c. The &quot;Dummy Unit&quot; unit. Change the DUMMY_UNITID to the rawcode that you find(it&#039;s &#039;n000&#039; in this map).
// 4. You have succesfully imported the spell <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin    :D" loading="lazy" data-shortname=":D" />

1, 3, 4?
:p .

Also, in front of all your globals put "private" :) .
And just to be safe, declare:
JASS:
local unit dummy = CreateUnit(p, DUMMY_UNITID, x, y, 0)

Last.
 

WolfieeifloW

WEHZ Helper
Reaction score
372
A couple noted things:
  • Still goes 1, 3, 4.
  • You don't need [noparse][/noparse] in your trigger (around NewGen links)
  • Your spacing is weird (see below)
All your stuff is aligned to the left.
Every 'new' thing should be tabbed inwards once;
Like so:
JASS:
scope...
    globals
        private...
    endglobals
    
    private function...
        &lt;Actions&gt;
    endfunction
endscope

Like that :) .
It's not needed but makes it a lot more readable.
 

Immolation

Member
Reaction score
20
Everything is fixed.

About the thing: They were placed automatic...e url there, and the forum attached the [url] thing.

Thanks for the comments :)
(will update God's Hand now :D)
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Haven't looked thoroughly through the code but it looks good now;
See how much better spacing makes it ;) .

I'll look through and test later :) .
 

Romek

Super Moderator
Reaction score
963
All the "something per level" should be a configurable, constant function.

It would be much easier for you to work in radians, rather than in degrees with constant converting.
Only converting you'd need to do that way would be the configurable.

JASS:

Should be:
JASS:
set degree = GetUnitFacing(caster)


Why do you actually have 2 identical loops? Why not just merge them into a single loop? :confused:

The spells seems awfully simple too.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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