1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. The 15th Mini-Mapping Contest came to an end. The Secrets of Warcraft 3 are soon to be revealed! Come and vote in the public poll for your favorite maps.
    Dismiss Notice
  4. The 12th incarnation of the Music Contest is LIVE! The theme is Synthwave. Knight Rider needs a song to listen to on his journey. You should definitely have some fun with this theme!
    Dismiss Notice
  5. Join other hivers in a friendly concept-art contest. The contestants have to create a genie coming out of its container. We wish you the best of luck!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Spell - Water Explosion 2.1

Submitted by Dark_Dragon
This bundle is marked as approved. It works and satisfies the submission rules.
Spell: Water Explosion - Creates water explosions around caster dealing x damage, depending on spells level.

Changelog


Version 1.1 - Added non-selection trigger for dummy's.

Version 1.2 - Paused timer before destroying it and nulled handle variables.

Version 1.3 - Now Fully MUI and code optimized a bit.

Version 1.3b - Fix whit leeks.

Version 1.3c - Only nulled a bit of variables.

Version 1.3d - In filter function replaced local variable to function GetFilterUnit() as I guess it is a bit of leek when using a variable.

Version 1.4 - Many important fixes, first timer activation area affection fix + first cast lag fix.

Version 1.5 - Uber update which gives this spell mass speed update jass->vjass ofc i don't mean its faster because of vjass it can only be slower in vjass if you don't know how it compiles it in jass however i do know and i can say this is the last update of this spell. Note this spell has no leaks and is completely fast as much as possible!

Version 1.6 Final - Last update improved speed decreased code size and make spell more configurable. It was by request of nerovesper to make it more configurable but i did increase speed a lot more and make code less in size. Its now at top speed and its last update i made for this spell.

Version 1.7 - Was a must update to make it 1.24 compatible! as well code is decreased and fast, using JNGPS.

Version 2.0 - Water Explosion Remasterd
- Totally recoded in zinc
- Fixed bug when units enter "water effect" area just after damage is dealt
- Caster now deals damage
- Fixed bug when caster did not deal damage, thats why dummy was used
Seems like UnitDamageTarget might not deal damage when unit casts/channels spell
- Primarely this is all fixed by adding timed area damage and g_once group which makes sure that units are damaged only once
- Now uses mini library

Version 2.1 - Recoded in Warcraft 3 v1.30
- Spell no longer requires JNGP
- Bug fixes, spell now tends to deal single damage per water explosion wave
- Alterd visuals, water shoots are shoot from far away from caster to closer range




Code
Code (vJASS):

// -------------------------------------------------------------------------
//                 *** Spell: Water Explosion
//                 *** Autor: Dark Dragon
//
//
// * Made on Warcraft III v1.30.4
//
// -------------------------------------------------------------------------
//                      *** Installation ***
//
// * Copy this trigger and DD Library to your map
// * Copy abilitie 'Water Explosion' to your map
// * Export and import 'WaterExplosion.mdx' from this map to your map (Credits: JetFangInferno)
// * Modify data below to your will, WEX_RAWCODE must be matched to your 'spell rawcode' in your map
// * Add water explosion to unit you want and edit below spell data to your needs
// * Enjoy!
// -------------------------------------------------------------------------


// -------------------------------------------------------------------------
//                  *** Main WaterExplosion library ***
//! zinc
library WaterExplosion requires DDLib
{

    //********************************************************************************
    //                        Edit following to your wish
    //********************************************************************************


    constant integer    WEX_RAWCODE         = 'WTex';    // Ability Water Explosion
    constant real     EXPLOSION_DELAY     = .5;        // How often explosions are created (in seconds)
    constant integer    WATER_SHOOTS       = 4;         // How much water shoots will happen, water sfx shoots
 constant real    INITIAL_EXPLOSION_OFFSET  = 50.;   // Extra offset to NEXT_EXPLOSION_OFFSET, on first water explosion
 constant real    NEXT_EXPLOSION_OFFSET   = 110.;   // How far does each next cycle explosion occure (linear damage/effect version)
 constant real    WATER_EXPLOSION_DENSITY   = 160.;   // Smaller numbers mean that explosions are closer together, it means how much of perimiter does it use (circular effect version)
 //constant real    EXPLOSION_ENHANCE_PERC   = 120.;   // This is correction of units being picked in percentage of NEXT_EXPLOSION_OFFSET, it means it will alternate area in which units are damaged
 constant boolean   DUMMY_DAMAGE     = false;   // Does dummy or caster deal damage?
 constant boolean   USE_TEXTTAG      = true;   // Enable or disable damage display

 constant integer   PROJECTILE_N     = 12;   // Missiles max number
 constant real    PROJECTILE_SIZE     = 1.3;   // Missiles size
    constant real     PROJECTILE_SPEED      = 750.;   // Missiles speed
    constant real     PROJECTILE_ARC        = 360.;   // Missiles max reached z
    constant real     PROJECTILE_RANGE      = 710.;   // Missiles max travel distance
 constant real     PROJECTILE_INIT_Z      = 0.;   // Missiles offset z
     
        // This are constant defined effects
    constant string    EXPLOSION_DAMAGE_EFFECT      = "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl";
    constant string    EXPLOSION_DAMAGE_EFFECT_ATTACH_POINT  = "origin";
    constant real     EXPLOSION_DAMAGE_EFFECT_INTERVAL   = .33;
    constant real     EXPLOSION_DAMAGE_EFFECT_DURATION   = 4.;
    constant string    WATER_EXPLOSION_EFFECT       = "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl";
    constant string    MISSILE_EFFECT               = "Abilities\\Weapons\\WaterElementalMissile\\WaterElementalMissile.mdl";
    constant string    MISSILE_SPAWN_EFFECT           = "war3mapImported\\WaterExplosion.mdx";
    constant real     MISSILE_SPAWN_EFFECT_SIZE       = .5;
    constant real     MISSILE_SPAWN_EFFECT_ANIMATION_SPEED  = 200.;

    private keyword waterexp;
   
 // *** Amount of damage dealed per level, if you use more or less than 3 levels, just delete or add additional lines in function below
 function WaterDamage(integer level) -> real {
  real damage[];

  // -----------------------------------------
  // *** edit this variables to your will
  damage[1] = 70.;
  damage[2] = 100.;
  damage[3] = 140.;
  damage[4] = 190.;
  damage[5] = 260.;
  // -----------------------------------------

  return damage[level];
 }

 // *** area of effect, that is max radius that spell will effect
 function WaterAoE(integer level) -> real {
  real aoe[];

  // -----------------------------------------
  // *** edit this variables to your will
  // you can use your custom aoe, but this uses n water explosions formula.
  //                 ˇˇ
  aoe[1] = INITIAL_EXPLOSION_OFFSET + NEXT_EXPLOSION_OFFSET*(4.);
  aoe[2] = INITIAL_EXPLOSION_OFFSET + NEXT_EXPLOSION_OFFSET*(4.);
  aoe[3] = INITIAL_EXPLOSION_OFFSET + NEXT_EXPLOSION_OFFSET*(5.);
  aoe[4] = INITIAL_EXPLOSION_OFFSET + NEXT_EXPLOSION_OFFSET*(5.);
  aoe[5] = INITIAL_EXPLOSION_OFFSET + NEXT_EXPLOSION_OFFSET*(6.);
  //                 ^^
  // -----------------------------------------

  return aoe[level];
 }
   
    function WaterMaxDamage(integer level) -> real {
        real max_damage[];

  // -----------------------------------------
  // *** edit this variables to your will
  // the max damage spell can deal per cast, use value of -1. to make spell have no limit of damage
  //
  max_damage[1] = 500.;
  max_damage[2] = 850.;
  max_damage[3] = 1100.;
  max_damage[4] = 1500.;
  max_damage[5] = 1600.;
  //                   ^^
  // -----------------------------------------

  return max_damage[level];

    }

 // *** Filtrate units to be damaged
 function DamageFilter(unit filterUnit, player casterOwner) -> boolean {
   return  !IsUnitType(filterUnit, UNIT_TYPE_DEAD)     &&
     IsUnitEnemy(filterUnit, casterOwner)       &&
     !IsUnitType(filterUnit, UNIT_TYPE_STRUCTURE)    &&
     !IsUnitType(filterUnit, UNIT_TYPE_MAGIC_IMMUNE)   &&
     !IsUnitType(filterUnit, UNIT_TYPE_ANCIENT)     &&
     !IsUnitType(filterUnit, UNIT_TYPE_FLYING)     &&
     !DDIsUnitWard(filterUnit)        &&
     BlzIsUnitSelectable(filterUnit)       &&
     !BlzIsUnitInvulnerable(filterUnit);
 }

 // ==============================================================================================================
 // *
 // *       *** Non-Editable code below ***
 // *
 // ==============================================================================================================

    //===============================================
    // Do not edit bellow if you don't know jass
    //===============================================


 // * Timed effect on unit
 struct timeffect {
  unit u;
  effect e;
  real timeout;

  static timeffect UnitData[];

  static method AddWaterEffect(unit u) {
   timeffect this;
   integer id = H2ID(u);
 
   if (UnitData[H2ID(u)] == p_null) {
    this = allocate();
    UnitData[id] = this;
    this.u = u;
    this.e = AddSpecialEffectTarget(EXPLOSION_DAMAGE_EFFECT, u, EXPLOSION_DAMAGE_EFFECT_ATTACH_POINT);
   
    DDStartTim(EXPLOSION_DAMAGE_EFFECT_INTERVAL, true, this, static method() {
     timeffect te = DDTimData();
   
     BlzPlaySpecialEffect(te.e, ANIM_TYPE_BIRTH);
     te.timeout -= EXPLOSION_DAMAGE_EFFECT_INTERVAL;
     if (te.timeout <= 0. || IsUnitType(te.u, UNIT_TYPE_DEAD)) {
      DestroyEffect(te.e);
      UnitData[H2ID(te.u)] = p_null;
      te.e = null;
      te.u = null;
      te.destroy();
      DDQuitTim();
     }
    });
   } else {
    this = UnitData[id];
   }
 
   this.timeout = EXPLOSION_DAMAGE_EFFECT_DURATION;
  }
 }

 // *** Group of missiles
 struct nexus {
  ddeffect e[PROJECTILE_N];
  effect se[PROJECTILE_N];
  real dx[PROJECTILE_N], dy[PROJECTILE_N];
  real wz, dist, max_dist;
  real offset_range;

  // *** Calculates missile z motion, default elliptical motion
  method MissileZ() -> real {
   return ((-4.*PROJECTILE_ARC/Pw_2(max_dist)) * Pw_2(dist-offset_range)) + PROJECTILE_ARC;
   //return SquareRoot( Pw_2(PROJECTILE_ARC) * (1. - Pw_2(((dist-offset_range)/(max_dist/2.))-1.)) );
  }
 }

 //--------------------------------------------------
    // *** WaterExplosion main struct ***
    struct waterexp {
        // Objects
        unit   caster;
  unit   dummy;
  real   x, y;
  player   owner;
        integer  level;
        integer  shoots;
        real   radius;
  real  dmg, cdmg, max_dmg;
  fogmodifier fm;

     
     
  // ------------------------------------------
        //     # Methodes
  // ------------------------------------------
     
  // ------------------------------------------
        //     *** Write constructor ***
        static method create() -> waterexp {
            waterexp this = allocate();
         
            // *** Assign members ***
            this.caster   = GetTriggerUnit();
            this.owner    = GetOwningPlayer(this.caster);
            this.level    = GetUnitAbilityLevel(this.caster, WEX_RAWCODE);
            this.radius   = INITIAL_EXPLOSION_OFFSET;
            this.x     = GetUnitX(this.caster);
            this.y     = GetUnitY(this.caster);
            this.shoots   = 0;
   this.cdmg   = 0.;
   this.dmg   = WaterDamage(level);
   this.max_dmg  = WaterMaxDamage(level);
   this.fm    = CreateFogModifierRadius(this.owner, FOG_OF_WAR_VISIBLE, this.x, this.y, WaterAoE(this.level) + NEXT_EXPLOSION_OFFSET, true, false);
   FogModifierStart(this.fm);
 
   static if (DUMMY_DAMAGE) {
    this.dummy = DDLoadDummy();
    SetUnitOwner(dummy, owner, false);
    SetUnitX(this.dummy, this.x);
    SetUnitY(this.dummy, this.y);
   }
         
            return (this);
        }
     


        // ------------------------------------------
        //     *** Write destructor ***
        method destroy() {
   static if (DUMMY_DAMAGE)
    DDRecycleDummy(this.dummy);
 
   FogModifierStop(this.fm);
   DestroyFogModifier(this.fm);
   this.fm = null;
   this.caster = null;
   deallocate();
        }
    }

   
    //===========================================================================
    //               **** Init water expl ****
    //===========================================================================
    function onInit() {
        trigger t = CreateTrigger();
        TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT);
        TriggerAddCondition(t, Condition(function() -> boolean {
            // Main Condition
            if (GetSpellAbilityId() != WEX_RAWCODE)
                // *** Skip remainig code
                return false;
 
            // *** Condition passed
            DDStartTimInst(EXPLOSION_DELAY, true, waterexp.create(), function() {
    // -------------------------------------
    // *** locals ***
    waterexp we = DDTimData();
    nexus n;
    integer i, max_i;
    real rad;
    // -------------------------------------
   
    // ================================================================================================
    //        *** Load water shoots ***
    // ================================================================================================
    if ( we.shoots < WATER_SHOOTS ) {
     // *** Increase shoots ***
     we.shoots += 1;
     n = nexus.create(); // Missiles
     n.dist = we.radius;
     n.max_dist = PROJECTILE_RANGE-we.radius;
     n.offset_range = we.radius+(n.max_dist/2.);
     n.wz = BlzGetUnitZ(we.caster);
   
     // *** Add enum graphics ***
     for(i=0; i < PROJECTILE_N; i+=1) {
      // *** Do calcs ***
      rad = i*(2.*bj_PI/PROJECTILE_N);
      // *** Add missiles ***
      n.dx[I] = Cos(rad);
      n.dy[I] = Sin(rad);
      n.e[I] = ddeffect.create(MISSILE_EFFECT, we.x + PROJECTILE_RANGE * n.dx[I], we.y + PROJECTILE_RANGE * n.dy[I], rad, PROJECTILE_SIZE);
      n.dx[I] *= -DD_INTERVAL*PROJECTILE_SPEED;
      n.dy[I] *= -DD_INTERVAL*PROJECTILE_SPEED;
     
      n.se[I] = AddSpecialEffect(MISSILE_SPAWN_EFFECT, n.e[I].X, n.e[I].Y);
      BlzSetSpecialEffectScale(n.se[I], MISSILE_SPAWN_EFFECT_SIZE);
      BlzSetSpecialEffectTimeScale(n.se[I], MISSILE_SPAWN_EFFECT_ANIMATION_SPEED/100.);
      BlzPlaySpecialEffect(n.se[I], ANIM_TYPE_STAND);
     }
     
     DDStartTim(200./MISSILE_SPAWN_EFFECT_ANIMATION_SPEED, false, n, function() {
      nexus n = DDTimData();
      integer i;
     
      for(i=00; i < PROJECTILE_N; i+=01) {
       DestroyEffect(n.se[I]);
       n.se[I] = null;
      }
     
      if (n.e[00] == p_null)
       n.destroy();
      DDQuitTim();
     });
     
     // ------------------------------------------------------------
     // *** Missile motion
     DDStartTim(DD_INTERVAL, true, n, function() {
      nexus n = DDTimData();
      integer i;
     
      // *** vars change apply ***
      n.dist += DD_INTERVAL*PROJECTILE_SPEED;
     
      // *** check if we still have a way to go ***
      if (n.dist < PROJECTILE_RANGE) {
       // *** Do the loop and move missiles
       for(i=0; i < PROJECTILE_N; i+=1) {
        n.e[I].PositionZ(n.e[I].X + n.dx[I], n.e[I].Y + n.dy[i],
              n.wz + PROJECTILE_INIT_Z + n.MissileZ());
       }
      } else {
       // *** Clear missiles and end motion ***
       for(i=0; i < PROJECTILE_N; i+=1) {
        n.e[i].destroy();
        n.e[i] = p_null;
       }
       if (n.se[00] == null)
        n.destroy();
       DDQuitTim();
      }
     });
    }
   
    // ================================================================================================
    //       *** Start Damage and explosions ***
    // ================================================================================================
   
    // ***
    // *** Increase distance
    // ***
    we.radius += NEXT_EXPLOSION_OFFSET;
    max_i = R2I(2.*we.radius*bj_PI / WATER_EXPLOSION_DENSITY);
   
    // -------------------------------------------
    // Loop ( loads water explosion effects )
    for(i=0; i < max_i; i+=1) {
     rad = (i * 2.*bj_PI) / max_i;
     DestroyEffect( AddSpecialEffect(WATER_EXPLOSION_EFFECT,
             we.x + we.radius * Cos( rad ),
             we.y + we.radius * Sin( rad )) );
    }
   
    // *** Start periodic scan for damage
    DDGroupFilterArea(we.x, we.y, we.radius+NEXT_EXPLOSION_OFFSET, we, function() -> boolean {
     waterexp we = DDGFilterData();
     unit f = GetFilterUnit();
     real life, damage = we.dmg;
     effect e;
     
     // Target unit has to be between target radius and radius - explosion offset
     if (DDHypot(GetUnitX(f)-we.x, GetUnitY(f)-we.y) >= Pw_2(we.radius-NEXT_EXPLOSION_OFFSET) && DamageFilter(f, we.owner)) {
      if (we.max_dmg != -1.) {
       life = GetWidgetLife(f);
       
       if (we.max_dmg-we.cdmg < damage)
        damage = we.max_dmg-we.cdmg;
       
       if (life < damage)
        damage = life;
       
       we.cdmg += damage;
      }
     
      static if (DUMMY_DAMAGE)
       DDSpellDamage(we.dummy, f, we.dmg);
      else
       DDSpellDamage(we.caster, f, we.dmg);
     
      static if (USE_TEXTTAG)
       if (damage >= 1.)
        DDNewTextTagUnit(f, "+"+I2S(R2I(damage)), 4., 10., 90., 88., 20.);
     
      timeffect.AddWaterEffect(f);
     }
     f = null;
     return false;
    });
   
    // ===========================================
    // * End when distance is out of area
    if (we.radius+1. > WaterAoE(we.level)) {
     static if (USE_TEXTTAG)
      DDNewTextTagUnit(we.caster, I2S(R2I(we.cdmg))+" damage dealt!", 5., 27., 84., 10., 20.);
     we.destroy();
     DDQuitTim();
    }
   
    // ===============================
    // ---- End main timer ------
    // ===============================
   });
           
            return false; // End Trigger condition
        }));
 
  // End onInit
    }
 
}

//! endzinc

// ============================================================================================
// Lua generation of objects!
// Change me from /* to // and then back to /* after saving and reopening the map
    // |
    // ˇ
      /*
     
// Credits: PurgeandFire for lua tutorial
//! externalblock extension=lua ObjectMerger $FILENAME$
     //! i -- ===================================================
     
     //! i WATER_EXPLOSION_ABIL_ID               = "WTex"
   
     //! i -- ===================================================
   
     //! i setobjecttype("abilities")
     //! i createobject("AHtc", WATER_EXPLOSION_ABIL_ID)
     //! i makechange(current,"anam", "Water Explosion")
     //! i makechange(current,"alev", "5")
     //! i makechange(current,"abpx", "3")
  //! i makechange(current,"arpx", "3")
  //! i makechange(current,"aart", "ReplaceableTextures\\CommandButtons\\BTNCrushingWave.blp")
  //! i makechange(current,"arar", "ReplaceableTextures\\CommandButtons\\BTNCrushingWave.blp")
  //! i makechange(current,"ahky", "W")
  //! i makechange(current,"arhk", "W")
  //! i makechange(current,"acat", nil)
  //! i makechange(current,"aret", "Learn |cff1a8cd0W|rater Explosion - [|cff0080c0Level "..string.char(37).."d|r]")
  //! i makechange(current,"arut", "|cff008040Deals damage in area around caster.|r|n|n|cff0080ffLevel 1|r -|cff80ffff Each explosion deals 70 damage, up to max 500 damage, in 470 aoe|r. |n|cff0080ffLevel 2|r - |cff80ffffEach explosion deals 100 damage, up to max 850 damage, in 470 aoe|r. |cff80ffff|n|r|cff0080ffLevel 3|r -|cff80ffff Each explosion deals 140 damage, up to max 1100 damage, in 610 aoe|r.|cff80ffff|n|r|cff0080ffLevel 4|r -|cff80ffff Each explosion deals 190 damage, up to max 1500 damage, in 610 aoe|r.|cff80ffff|n|r|cff0080ffLevel 5|r -|cff80ffff Each explosion deals 260 damage, up to max 1600 damage, in 610 aoe|r.")
 
     
     //! i local i = 0
     //! i local dmg = { "70", "100", "140", "190", "260" }
  //! i local maxdmg = { "500", "850", "1100", "1500", "1600" }
  //! i local aoe = { "470", "470", "610", "610", "610" }
     //! i for i=1, 5 do
        //! i local si = tostring(i)
        //! i makechange(current,"Htc1",si,"0.")
        //! i makechange(current,"aare",si,"0.")
        //! i makechange(current,"Htc3",si,"0.")
  //! i makechange(current,"Htc4",si,"0.")
  //! i makechange(current,"abuf",si,nil)
        //! i makechange(current,"ahdu",si,".01")
        //! i makechange(current,"adur",si,".01")
        //! i makechange(current,"amcs",si,tostring(100 + 25*i))
        //! i makechange(current,"atp1",si,"|cff1a8cd0W|rater Explosion - [|cffffcc00Level "..si.."|r]")
  //! i makechange(current,"aub1",si,"|cff1a8cd0Deals "..dmg[i].." damage per explosion, up to max "..maxdmg[i].." damage, in "..aoe[i].." aoe.|r")
 
     //! i end
//! endexternalblock

       */

    // ^
    // |
// Change me from */ to // and then back to */ after saving and reopening the map
// ============================================================================================

 
[/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I]


Credits: JetFangInferno

If you have any future questions ask here.
Have Fun!

~Dark Dragon


Keywords:
Water, Explosion, Spells, any, other, DD, wave, nova
Contents

Spell - Water Explosion (Map)

Reviews
Moderator
Diablo-dk: [Approved] The spell is MUI and works fine ingame.
  1. Diablo-dk: [Approved]
    The spell is MUI and works fine ingame.
     
  2. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    591
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    I used constant functions all ready so I don't understand what should I do more, if you think that when I use globals whit no array that its not MUI that is not true because if you look better this variables are used in instant actions. Not sure is it fully MUI but MPI is for sure that is enough if its a hero spell right?

    Now I know I am not so good but I am still learning jass and how to code a good spell or anything, ty for teaching me about PauseTimer did not know it must be used before destroying it.
     
  3. Diablo-dk

    Diablo-dk

    Joined:
    Nov 10, 2004
    Messages:
    369
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    According to the rules, a JASS spell must be fully MUI. Take a look at KaTTaNa's local handle variables system, which is great at making MUI Jass spells. http://www.wc3jass.com/viewtopic.php?t=224

    I didn't say it had anything about the spell being MUI. It was a suggestion, so you don't have to follow it, since i do understand why you used globals.

    Make the spell fully MUI and null the handle variables, then i'll approve it. (If you don't know what nulling handle variables means, search for a jass tutorial. I'm sure you can find an answer there)
     
  4. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    591
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    ok I will try this

    Edit: Ok its updated now its MUI whit no handle local variables system as no one could find the problem
     
  5. Herman

    Herman

    Joined:
    Aug 20, 2007
    Messages:
    877
    Resources:
    0
    Resources:
    0
    Simple improvements

    The first, I noticed you used degrees for the angle, as this makes it very easy to write the code, it is almost always more efficient to use radians, I studied your code a bit, and every single time WE needs to loop, it needs to make those unnecessary bj_DEGTORAD calculations

    The second, your system to retrieve timer data is good, but I don't see anywhere that you nulled/cleared the timer data global for finished timers, your system would be very good, but it will keep looping through all of your un-used timers every time you retrieve the data, which you do every time the timer expires, almost like putting a loop inside a loop

    Either get a different system that doesn't need to loop, or just make sure you clear + null the variables so the system doesn't need to loop through 200 expired timers your not even using

    These are both pretty minor, but will definitely improve your code


    [For the timer data system, if you'd like a guage on how mcuh better a loopless system would be, those systems only loop once, so if your system only looped once it would be slightly more efficient (less if/thens), but every time it needs to loop, it becomes that many more times slower, in other words if you have 50 timers stored in the data, your system would be 50x slower than a loopless(give or take 5x due to if/thens)]
     
  6. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    591
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    Hi Herman!

    Well its nice you got a look in a spell so lets start to explain things out ^^.

    1. Using bj_DEGTORAD is much faster then any other conversion as its a global already calculated constant in blizzard.j Its always much better to use constants as they are very fast.

    2. There is only one timer per cast which gets destroyed very fast, as function ClearUserTimerData( timer whichTimer, boolean destroy ) so I don't need to do manual destroy. Note that only one timer loops the spell function, and gets soon destroyed.

    3. The system of timer data which you say are lot, well as I explained there are timers equal to instant spell casting times. So if 3 players cast spell at same time there will be 3 timers (3 loops) btw jass if/then is fast GUI one creates function which is slow but in jass thats not a problem.

    4. Thanks for commenting!

    Edit: Lol sorry when I started to make this spell I made it MPI and then I waste my time on why Handle Locals dont work for me, in that time I forget to make ClearTimerData, thanks now its fixed.
     
  7. Herman

    Herman

    Joined:
    Aug 20, 2007
    Messages:
    877
    Resources:
    0
    Resources:
    0
    What I ment with the DEGTORAD, was that you should use the RADTODEG function, and just calculate in radians (one of the things that will cost you more time, but will improve your code)

    If you don't need/want to do that (or don't know how) it's ok, its a pretty minor thing, should be kept in mind for big systems though

    Yeah, I wasn't sure about the timers getting destroyed, it would only be slower if the timers were not removed, but I *think* you said you did

    The timer thing is very very efficient way of doing if everything is used properly (I might even switch over to it, because I only ever put handlevars on timers)

    Great job !!! :D
     
  8. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    591
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    You were right as I sad I did not destroy timers before I mean I did but did not clear the stored data on timer that was a leak but now its fixed. Only one thing about RADTODEG and DEGTORAD this are not the functions they are global constant variables and its same to say:

    set var = 2*3
    or
    set var = 2 * bj_DEGTORAD

    look:

    constant real bj_DEGTORAD = bj_PI / 180.
    constant real bj_RADTODEG = 180. / bj_PI

    where bj_PI is:

    constant real bj_PI = 3.14159

    So only for your info, it does not matter which one you use they are the same its like you use:

    set var = 2/4
    set var2 = 4/2

    it does not rely matter, note I only tried to explain you, this is for sure same thing as you can find them in blizzard.j dont tread this as function for conversion this is only a constant global variable.

    I guess I explained it well, once more ty for comment.
     
  9. Herman

    Herman

    Joined:
    Aug 20, 2007
    Messages:
    877
    Resources:
    0
    Resources:
    0
    sorry I keep referring to it as a function, but yeah I udnerstand what you mean by the calculations, what I'm saying is inside your actual code you need to constantly flip between radians and degrees, because most of the functions take measurements in radians or return in radians

    Although there are a select few that take degrees (like unit facing)
     
  10. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    591
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    Well I guess I explained it well so you now understand that its same do you want to work in RAD or DEG just 1 deg = PI / 180. or 180 deg = PI just what you like to work whit its your same but as its simple to work whit deg so I used deg. If you like more RAD then DEG you can always work in RAD, I just wanted to tell you its same about speed.
     
  11. eWs.Azure

    eWs.Azure

    Joined:
    Apr 1, 2008
    Messages:
    23
    Resources:
    0
    Resources:
    0
    looks awesome :D very nice done
     
  12. Sacredmage

    Sacredmage

    Joined:
    Sep 30, 2007
    Messages:
    20
    Resources:
    0
    Resources:
    0
    you have to make the dummies unattackable, the mobs attacked the water beams that fly out when you cast it...
     
  13. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    591
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    they are used for attack effect and cant be untouchable but they are soon removed and there selection hight is 2^11 which cant be seen, and I guess I did something more but not sure: nothing you need to worry!
     
  14. Dragzor

    Dragzor

    Joined:
    May 11, 2008
    Messages:
    1
    Resources:
    0
    Resources:
    0
    How The Fuck U Make This Work
     
  15. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    591
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    Hmm...
    1) Plz turn off the caps lock
    2) You need to tell me exactly what is wrong!
    - Like do you have problems importing it in your map or you want to make spell like that and you don't know how, or is it something else like you don't know JASS or something.

    If so then just copy trigger in your map as well as units and ability. Now check which raw codes are used in your map for units and abilities and then simple edit code when you see 'e000' - this is a raw code edit it to match your map.

    Good luck, if you cant make it work I may be able to import it for you, if you send me your map.
     
  16. DushanS94

    DushanS94

    Joined:
    May 26, 2008
    Messages:
    6
    Resources:
    0
    Resources:
    0
    Hey can someone import this spell into my map and send it to me because i am either stupid or something else is wrong, because i did everything the script asks even the custom raw codes, and when I save the map i get tons of PJass errors + i cant open the map in Frozen Throne. Please help me, this spell is very important for my map, of course both Dark_Dragon and the person who helps me will get full credit. :)
     
  17. Kazemaru

    Kazemaru

    Joined:
    May 27, 2008
    Messages:
    55
    Resources:
    0
    Resources:
    0
    Hi! I saw your spell and it was awesome! But i need help to one spell: I want to make &quot;Posession&quot; (banshees 3lvl ulti) Spell like but I want that Unit/Hero who casted Posession has able to come out from Controlled unit/hero and Controlled unit will come back to its original team. Can you please make that spell? please =)
     
  18. Dark_Dragon

    Dark_Dragon

    Joined:
    Jul 19, 2007
    Messages:
    591
    Resources:
    8
    Tools:
    1
    Spells:
    7
    Resources:
    8
    Kazemaru here is the spell you requested: http://www.hiveworkshop.com/resources_new/spells/1422
     
  19. Dethekkus

    Dethekkus

    Joined:
    May 26, 2008
    Messages:
    28
    Resources:
    0
    Resources:
    0
    Looks good.