Spell Wild Axes

Trollvottel

never aging title
Reaction score
262
Well i haven't worked with the world editor for some time, so i'm a bit rusty. But here is the Wild Axes spell.

vJass: YES
MUI: Sure
Leakless: Yes, AFAIK
Lagless: Depends on what you do with my spell
Needs TT: Yes like each of my spells ^^.

Description:
Rexxar hurls his two axes outward, which then intersect and return to him. Each axe can only damage a unit twice.
* Its a remake of the DotA spell

Screenshot
(looks better ingame):
scr1cn7.jpg

Code( you wont like it...):
JASS:
scope WildAxes initializer InitTrig

//==========================================WILD AXES BY TROLLVOTTEL==========================================\\
// WHAT WILL IT DO:
//      * It will throw two axes to the target location, they will fly with a nice parabola and then come back.
//      * If they hit enemy units they will damage them, the axes can hit a unit twice.
//      * you can also knockback units if you have a knockback system, since the function to call on each unit
//        is below, its called DoStuff. So you can do many things with the units.
//
// IMPORT INSTRUCTIONS:
//      * Import the ability and the unit into your map.
//      * If you haven't it already, copy the TT trigger into your map.
//      * Copy in this trigger into your map.
//      * Change the constants below (the rawcodes will be different in different maps).
//=============================================================================================================\\
globals
    private constant integer DUMMYRAW = 'h000' // Dummy Axe raw code
    private constant integer SPELLRAW = 'A000' // Spell raw code
    private constant real DEGSPS = 128.        // degrees per second to fly by the axes
    private constant real RADIUS = 150.        // radius of the curve on the y-axis
    private constant real PICKRADIUS = 128.    // radius to pick and damage units
endglobals

// so you have the caster unit, with the name caster and the picked unit with the name victim
// do whatever want to do with them
private function DoStuff takes unit caster, unit victim returns nothing
    local real damage = 100 + GetUnitAbilityLevel(caster, SPELLRAW) * 50
    // put in you conditions here:
    if GetWidgetLife(victim) > .405 and IsUnitEnemy(caster, GetOwningPlayer(victim)) and IsUnitType(victim, UNIT_TYPE_STRUCTURE) != true then
        // put in your stuff here:
        // for example damage it:
        call UnitDamageTarget(caster, victim, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
        // and add a blood effect to it:
        call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Human\\HumanBlood\\BloodElfSpellThiefBlood.mdl", victim, "origin"))
    endif
endfunction

//--------------------------------------
//dont edit below//

private struct Axes
    unit Axe1
    unit Axe2
    unit caster
    real incr = 0
    real xrad
    real turnang
    real cenx
    real ceny
    real tx
    real ty
    group victims = CreateGroup()
        method onDestroy takes nothing returns nothing
            //remove leaks and remove units
            call DestroyGroup(.victims)
            call KillUnit(.Axe1)
            call KillUnit(.Axe2)
            call ShowUnit(.Axe1, false)
            call ShowUnit(.Axe2, false)
        endmethod
endstruct
                                                                                                                            
private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == SPELLRAW
endfunction

globals
    private unit CASTER
    private group TEMPGROUP
endglobals

private function FilterFunc takes nothing returns boolean
    local unit u = GetFilterUnit()
    
    // every unit can be only damaged twice
    if not IsUnitInGroup(u, TEMPGROUP) then
        call DoStuff(CASTER, u)
        call GroupAddUnit(TEMPGROUP, u)
    endif
    set u = null
    return false
endfunction


private function SendBack takes nothing returns boolean
    local Axes dat = TT_GetData()
    local real nx
    local real ny
    local real dx
    local real dy
    local real cx = GetUnitX(dat.caster)
    local real cy = GetUnitY(dat.caster)
    local real cenx
    local real ceny
    local real angle
    local real distance
    local real newangle
    local real radius
    local real turnang
    local group g 
    
    set dat.incr = dat.incr - DEGSPS*TT_PERIOD
    
    if dat.incr <= 0 then
        //after reaching the caster, the Axes disappear
        call dat.destroy()
        return true
    endif
    
    
    //since the axe is flying towards the caster, we cant use constants like below in the targetfly function
    
    //get center between spell-point and caster-position
    set cenx            = ( cx + dat.tx ) / 2
    set ceny            = ( cy + dat.ty ) / 2
    
    //delta
    set dx              = dat.tx - cx
    set dy              = dat.ty - cy
    
    //distance and angle
    set turnang         = Atan2     ( dy, dx )
    set distance        = SquareRoot( dx * dx + dy * dy )
    set radius          =        distance / 2
    
        //! textmacro MoveBack takes NUMBER, PLUSMIN
        set g = CreateGroup()
        //getting the normal position
        set newangle    = 180 $PLUSMIN$ dat.incr
        set nx          = cenx  + radius        * Cos(newangle * bj_DEGTORAD)
        set ny          = ceny  + RADIUS        * Sin(newangle * bj_DEGTORAD)
        set dx          = nx    - cenx
        set dy          = ny    - ceny
        
        set angle       = Atan2     ( dy, dx )      + turnang
        set distance    = SquareRoot( dx * dx + dy * dy )
        //turning point around the location(cenx,ceny)
        set nx          = cenx + distance       * Cos(angle)
        set ny          = ceny + distance       * Sin(angle)
        
        //moving unit
        call SetUnitX(dat.Axe$NUMBER$, nx)
        call SetUnitY(dat.Axe$NUMBER$, ny)
        call SetUnitFacing(dat.Axe$NUMBER$, angle*bj_RADTODEG $PLUSMIN$ 90.)
        // picking units
        set CASTER      = dat.caster
        set TEMPGROUP   = dat.victims
        call GroupEnumUnitsInRange  ( g, nx, ny, PICKRADIUS, Condition( function FilterFunc ) )
        call GroupAddGroup          ( g, dat.victims )
        call DestroyGroup           ( g )
        set g           = null
        //! endtextmacro
    
    //i put everything in a textmakro for better readability
    //! runtextmacro MoveBack("1", "+")
    //! runtextmacro MoveBack("2", "-")
    
    return false
endfunction

private function TargetFly takes nothing returns boolean
    local Axes dat = TT_GetData()
    local real nx
    local real ny
    local real dx
    local real dy
    local real angle
    local real distance
    local real newangle
    local group g 
    set dat.incr        = dat.incr + DEGSPS*TT_PERIOD
    
    if dat.incr >= 180. then
        //if the axes have reached their destination, they come back
        call TT_Start   ( function SendBack, dat )
        call GroupClear ( dat.victims )
        return true
    else
            set g = CreateGroup()
            
            //! textmacro Move takes NUMBER, PLUSMIN
            
            //getting the normal position
            set newangle    = 180       $PLUSMIN$ dat.incr
            set nx          = dat.cenx  + dat.xrad      * Cos(newangle * bj_DEGTORAD)
            set ny          = dat.ceny  + RADIUS        * Sin(newangle * bj_DEGTORAD)
            set dx          = nx        - dat.cenx
            set dy          = ny        - dat.ceny
            
            set angle       = Atan2     ( dy, dx )      + dat.turnang
            set distance    = SquareRoot( dx * dx + dy * dy )
            //turning point around the location(cenx,ceny)
            set nx          = dat.cenx + distance       * Cos(angle)
            set ny          = dat.ceny + distance       * Sin(angle)
            
            //moving unit
            call SetUnitX(dat.Axe$NUMBER$, nx)
            call SetUnitY(dat.Axe$NUMBER$, ny)
            call SetUnitFacing(dat.Axe$NUMBER$, angle*bj_RADTODEG $PLUSMIN$ 90.)
            
            // picking units
            set CASTER      = dat.caster
            set TEMPGROUP   = dat.victims
            call GroupEnumUnitsInRange  ( g, nx, ny, PICKRADIUS, Condition( function FilterFunc ) )
            call GroupAddGroup          ( g, dat.victims )
            call DestroyGroup           ( g )
            set g           = null
            //! endtextmacro
            
        //i put everything in a textmakro for better readability
        //! runtextmacro Move("1", "+")
        //! runtextmacro Move("2", "-")
        
    endif
    
    
    return false
endfunction                                                                                                                            
private function Actions takes nothing returns nothing
    local Axes dat      = Axes.create       (               )
    local unit ca       = GetTriggerUnit    (               )
    local real cx       = GetUnitX          ( ca            )
    local real cy       = GetUnitY          ( ca            )
    local location sp   = GetSpellTargetLoc (               )
    local real tx       = GetLocationX      ( sp            )
    local real ty       = GetLocationY      ( sp            )
    local real dy       = ty-cy
    local real dx       = tx-cx
    local real angle    = Atan2             ( dy, dx        )
    local real distance = SquareRoot        ((dx*dx)+(dy*dy))
    local player p      = GetOwningPlayer   ( ca            )
    
    // angle between the caster and the spell target point (in radians)
    set dat.turnang = angle
    
    // create the units
    set dat.Axe1    = CreateUnit( p, DUMMYRAW, cx, cy, angle * bj_RADTODEG )
    set dat.Axe2    = CreateUnit( p, DUMMYRAW, cx, cy, angle * bj_RADTODEG )
    
    // the radius (on the x-axis)
    set dat.xrad    = distance / 2.
    
    // get center point between caster and spell target point
    set dat.cenx    = (cx+tx)  / 2.
    set dat.ceny    = (cy+ty)  / 2.
    
    // pass some variables which are needed later
    set dat.tx      = tx
    set dat.ty      = ty
    set dat.caster  = ca
    
    // start the movement
    call TT_Start( function TargetFly, dat )
    
    call RemoveLocation(sp)
    
    set sp          = null
    set ca          = null
endfunction

//===========================================================================
private function InitTrig takes nothing returns nothing
    local trigger t  = CreateTrigger(  )
    call TriggerAddAction               ( t,            function Actions      )
    call TriggerAddCondition            ( t, Condition( function Conditions ) )
    call TriggerRegisterAnyUnitEventBJ  ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT   )
endfunction

endscope
Before i forget, please post comments :) (and if you want, you can also +rep me :p)

And, finally, the map:
 

Attachments

  • WildAxes.w3x
    50.3 KB · Views: 312

Trollvottel

never aging title
Reaction score
262
im glad that you like it :)

well, any other comments? any bugs found? any way to make the coding more efficent?
 
A

Andy

Guest
Wow. Been after something liket his for ages. Thanks!

By the way, in your ability tooltip for learning, it says "lear Wild Axes" instead of "Learn Wild Axes" :p
 

waaaks!

Zinctified
Reaction score
255
emjlr3 already made wild axes, black hole, and toss in one spellpack, but i think he didnt release it on public

gj with this
 

Arie

Cool Member
Reaction score
5
Hmm... Still confusing me.:confused:

Would you mind to give me another example ? if those enemies are hit by the axe, the enemies will get bloodlust.
 

Trollvottel

never aging title
Reaction score
262
oh weird >.< yeah... well it doesnt exist anymore and the code is removed..

@arie:

do you have any basic jass knowledge? it would make the things easier.
 

emjlr3

Change can be a good thing
Reaction score
395
i guess this boils down to whether there is a need for a 3rd one of these

this is really in no way better then mine(which isn't perfect by any means), therefore, especially considering they both use TT, I see no reason to approve this
 

Trollvottel

never aging title
Reaction score
262
actually its the second one since the GUI version is graveyarded and there isnt a map nor a code. And this Wild Axes spell is a bit more flexible since the user isnt restricted to let the axes damage hit units, they can also knockback, toss, etc..
But, if you dont want to you dont have to approve this and since you dont want to, you wont.
 

emjlr3

Change can be a good thing
Reaction score
395
its not easier to do so in your version then mine, aside from the location of your function in relation to the rest
 

Tukki

is Skeleton Pirate.
Reaction score
29
This one is 'better' as its parabola looks better eye-candy-wise.

You can also reduce the number of devisions by 2 (x/2) by multiplying with 0.5 instead. You wont notice it in-game, but its still good effiency-wise. Else good job on this!
 

emjlr3

Change can be a good thing
Reaction score
395
its the same bezier curve equation....which is completely configurable, as far as the arc is concerned
 

Tukki

is Skeleton Pirate.
Reaction score
29
yeah, if the user is interested in figuring out what looks best.
 

emjlr3

Change can be a good thing
Reaction score
395
thats sort of the point of configuration no?
 

Tukki

is Skeleton Pirate.
Reaction score
29
Yeah, changing values if they are wrong/not as you like them. But that doesn't mean they should be strange from the beginning, right?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • 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 Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top