Spell Multi-Slash

elmstfreddie

The Finglonger
Reaction score
203
I realized I have never made a spell... So, I decided to make one!
It's my... second JASS trigger, so if there are any discrepancies please inform me!!!

MUI: Yup

Import Difficulty: Easy, just copy and paste the trigger
BJs: One, the any unit event.

The blade master goes into a rage, striking a unit and stunning the target until he fails. The chance to fail increases with every strike, but the damage done increases by every strike. Also, time between strikes is decreased with every strike. If the 15th strike is made on the level 3 of the ability, you instantly kill the target.

Map attached with the spell. Warning, the map has no prettiness. It's just dirt with some units. I suck too much at terrain, so I spared your eyes and made it blank.
Here's the coding for the ability:
JASS:
function TextTagMessage takes texttag tt,real lifespan,integer colourred,integer colourgreen,integer colourblue,integer transparency,real fadepoint,real x,real y,real heightoffset,real xspeed,real yspeed,string message,real size,boolean show returns nothing
    call SetTextTagPermanent(tt,false)
    call SetTextTagLifespan(tt,lifespan)
    call SetTextTagColor(tt,colourred,colourgreen,colourblue,transparency)
    call SetTextTagFadepoint(tt,fadepoint)
    call SetTextTagPos(tt,x,y,heightoffset)
    call SetTextTagVelocity(tt,xspeed,yspeed)
    call SetTextTagText(tt,message,size)
    call SetTextTagVisibility(tt,show)
endfunction

function Trig_Slash_Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local unit Target = GetSpellTargetUnit()
    local real CasterX
    local real CasterY
    local real TargetX
    local real TargetY
    local real CasterNewX
    local real CasterNewY
    local real MirrorEffectX
    local real MirrorEffectY
    local texttag array t
    local integer l = 1
    local effect array blood
    local effect array mirroreffect
    loop 
        exitwhen l > (GetUnitAbilityLevel(Caster,'A000')*5)
        call PauseUnit(Caster,true)
        call PauseUnit(Target,true)
        //Pauses the caster and target to prevent problems, however pausing target is unnecessary
        set CasterX = GetUnitX(Caster)
        set CasterY = GetUnitY(Caster)
        set TargetX = GetUnitX(Target)
        set TargetY = GetUnitY(Target)
        //Edit (5.00*l)*2 for damage dealt
        set CasterNewX = GetLocationX(GetUnitLoc(Target)) + 100.00 * Cos(l*45.00*(3.14159/180.00))
        set CasterNewY = GetLocationY(GetUnitLoc(Target)) + 100.00 * Sin(l*45.00*(3.14159/180.00))
        //Setting polar offsets for the caster
        //No need to edit
        call SetUnitPosition(Caster,CasterNewX,CasterNewY)
        //Moves the caster to his new spot
        call SetUnitFacing(Caster,((l*45.00)+180.00))
        //Makes the caster face the target
        call SetUnitAnimation(Caster,"attack")
        //Gives the illusion of the Caster attacking
        set MirrorEffectX = GetLocationX(GetUnitLoc(Target)) + 100.00 * Cos(((l*45.00)-45.00)*(3.14159/180.00))
        set MirrorEffectY = GetLocationY(GetUnitLoc(Target)) + 100.00 * Sin(((l*45.00)-45.00)*(3.14159/180.00))
        //Setting polar offsets for the mirror image effect
        //No need to edit
        set mirroreffect[l] = AddSpecialEffect("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl",MirrorEffectX,MirrorEffectY)
        if( not (l == 15)) then
            if((GetRandomInt(1,50)) >= l) then
                call UnitDamageTarget(Caster,Target,((5.00*l)*2),true,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_AXE_MEDIUM_CHOP)
                if((GetUnitState(Target,UNIT_STATE_LIFE))== 0) then
                    set blood[l] = AddSpecialEffect("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl",GetUnitX(Target),GetUnitY(Target))
                    set t[l] = CreateTextTag()
                    call TextTagMessage(t[l],1.50,255,20,20,255,(1.00-(0.05*l)),GetUnitX(Caster),GetUnitY(Caster),0.00,0.00,0.030,"DEADLY BLOW!",0.03,true)               
                    call PauseUnit(Caster,false)
                    call PauseUnit(Target,false)
                    set t[l] = null
                    set Caster = null
                    set Target = null
                    set blood[l] = null
                    set mirroreffect[l] = null
                    return
                else
                    set blood[l] = AddSpecialEffect("Objects\\Spawnmodels\\Orc\\Orcblood\\BattrollBlood.mdl",GetUnitX(Target),GetUnitY(Target))
                    set t[l] = CreateTextTag()
                    call TextTagMessage(t[l],1.50,255,20,20,255,(1.00-(0.05*l)),GetUnitX(Caster),GetUnitY(Caster),0.00,0.00,0.036,(I2S(((5*l)*2))+"!"),0.014+(0.001*l),true)                
                endif
            else
                call TextTagMessage(t[l],1.50,255,20,20,255,(1.00-(0.05*l)),GetUnitX(Caster),GetUnitY(Caster),0.00,0.00,0.036,"Failed",0.025,true)
                call PauseUnit(Caster,false)
                call PauseUnit(Target,false)
                call TriggerSleepAction(1.50)
                set t[l] = null
                set Caster = null
                set Target = null
                set blood[l] = null
                set mirroreffect[l] = null
                return
            endif                    
        else
            set blood[l] = AddSpecialEffect("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl",GetUnitX(Target),GetUnitY(Target))
            set t[l] = CreateTextTag()
            call TextTagMessage(t[l],1.50,255,20,20,255,(1.00-(0.05*l)),GetUnitX(Caster),GetUnitY(Caster),0.00,0.00,0.036,"DEADLY BLOW!",0.03,true)                
            call PauseUnit(Caster,false)
            call PauseUnit(Target,false)
            set t[l] = null
            set Caster = null
            set Target = null
            set blood[l] = null
            set mirroreffect[l] = null
            return
        endif
        call TriggerSleepAction(0.25)
        call DestroyEffect(mirroreffect[l])
        call TriggerSleepAction(((0.50-(0.05*l)))-0.25)
        //((1.00-(0.05*l))) makes time between attacks shorten, change if desired
        call DestroyEffect(blood[l])
        //Destroy the blood effect
        set l = l + 1
    endloop
    call PauseUnit(Caster,false)
    call PauseUnit(Target,false)    
    set t[l] = null
    set Caster = null
    set Target = null
    set blood[l] = null
    set mirroreffect[l] = null                
endfunction


If you want to use this in your map, don't give credit to yourself.
If you have credits in your map, put me in them. Otherwise, I don't care :)


Edit > Nulled mirroreffect and decreased time between attacks for a more... Good spell.
Edit > Made condition shorter (thanks PurgeandFire) and got rid of 1 of the BJs.
 

Attachments

  • Slash.w3x
    17.7 KB · Views: 330

PurgeandFire

zxcvmkgdfg
Reaction score
509
GJ!

This:
JASS:
function Trig_Slash_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A000' ) ) then
        return false
    endif
    return true
endfunction

Can just be this:
JASS:
function Trig_Slash_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction


Other than that, I don't think it leaks and I think it is good. GJ!

P.S. Effects need to be nulled as well. ;)
 

Tinki3

Special Member
Reaction score
418

Vulcansurge

Ultra Cool Member
Reaction score
27
When I palyed, the system worked well. Im not sure why, but after a while I kept getting DEADLY BLOW!! and killing the enemies instantly :/... Is that meant to happen?

Also, you seem to have alot of functions being called, with is why your trigger is so long, 129 lines. All of the texttag triggers seem to be doing the same thing (turn red, set perishability, move up, fade out), so you should make that into a seperate set of actions and call them when you need them. Other than my ranting, this is a good trigger, keep it up.

Overall: 7/10

BTW, what are BJ's?
 

Tinki3

Special Member
Reaction score
418
> BTW, what are BJ's?
emjlr3:
A bj refers to a function from the blizzard.j file which contains functions that are used by GUI when you add actions, events of conditions. There is another file called common.j which houses all the native files made by blizzard. These are functions which are called by bj functions to do things, and call no other functions themselves. Why is this important? Well, for 2 reasons, speed and leaks. Why would you want to call a function, which calls another, which calls another, which finally does what you want it to do? When you could just call that final native function and do it in 1 step? Also, some bj functions have leaks in them, which can be avoided through the use of natives.
 
I

IKilledKEnny

Guest
Nice spell, good job, congrats.

Comments.

Spell:

Everything is fine but the fact that it looks a bit odd when the caster keeps changing the angle towards the target, it isn't smooth. I would suggest canceling that, or perhaps adding a teleport special effect so it would look more realistic? Overall: Great job beside that flaw.

Trigger:

'a' And 'b' are not good names, very uninformative. 'caster' And 'target' (or victim) will make the trigger much better.

JASS:
    
    local real aX
    local real aY
    local real bX
    local real bY


Why don't you set these when they are declared.

JASS:
    
    local real aX=GetUnitX(a)
    local real aY=GetUnitY(a)
    local real bX=GetUnitX(b)
    local real bY=GetUnitY(b)


JASS:
            if((GetUnitState(b,UNIT_STATE_LIFE))== 0) then
                set e[l] = AddSpecialEffect("Objects\\Spawnmodels\\Orc\\OrcLargeDeathExplode\\OrcLargeDeathExplode.mdl",GetUnitX(b),GetUnitY(b))
                set t[l] = CreateTextTag()
                call SetTextTagPermanent(t[l],false)
                call SetTextTagLifespan(t[l],1.50)
                call SetTextTagColor(t[l],255,20,20,255)
                call SetTextTagFadepoint(t[l],(1.00-(0.05*l)))
                call SetTextTagPos(t[l],GetUnitX(a),GetUnitY(a),0.00)
                call SetTextTagVelocity(t[l],0.00,0.036)
                call SetTextTagText(t[l],"DEADLY BLOW!",0.030)
                call SetTextTagVisibility(t[l],true)                
                call PauseUnit(b,false)
                call PauseUnit(a,false)
                set t[l] = null
                set a = null
                set b = null  
                return
            endif


it would be more accurate to post this part after the unit have been damaged from the latest hit.

JASS:
 if( not (l == 15)) then


This is just confusing, why don't you switch between the "then" and "else" actions.

Also, I would suggest using more constant functions so the spell could be easily modified.

Other then that seems fine.
 

elmstfreddie

The Finglonger
Reaction score
203
Guys, I said it's my first JASS spell. I have no clue how to use constant functions >.<
(Kenny, when will you teach those?)

Uhm, I thought I did null the special effects...

The reason I didn't set the x and y when I made them is because the caster moves and my original idea was to have the target be able to move too well he was being attacked.

>it would be more accurate to post this part after the unit have been damaged from the latest hit.

Well that would make it say the damage and deadly blow, they would stack and it would be dumb. That just made more sense to me.

Oh, and I didn't have a separate function for the text tags because I didn't know how to do takes properly, I didn't know whether to state what type it takes, what the name is of what it takes, or both. I'm still a JASS noob ;)

Thanks for the comments everyone.


OH, the damage BJ. Thought I was missing one.
The reason is I couldn't seem to find out how to convert a unit to a Widget. (meaning, can someone tell me how to convert a unit into a widget). Still, BJs aren't gonna kill you.

there goes another great GUIer........
I don't really make maps at all, I just learn to help other people. Everyone else is learning JASS, so I better know it too to help!!!
 

Sooda

Diversity enchants
Reaction score
318
Move things what are constants to constant functions, it' s then easier to edit your ability after. Use variable names what mean something if there is casting unit don' t name that variable "o" but instead "castingUnit". It helps alot people to speed up learning, editing your JASS.
 

elmstfreddie

The Finglonger
Reaction score
203
K everyone I'm trying to make this as easy as possible. I am turning the text tags into functions so that it's shorter.
I found out how on my own, yay.

Edit > Ok edited original post, it has a separate function for the text tags and I cleaned it up a bit, changed some variable names, etc.

Soon to come:
A mirror image effect
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Also, I don't think that the t[1] array needs to be an array because it is used only as one array... In the beginning, I think you can just set the local as "CreateTextTag()"
Then remove all of the extra "CreateTextTags" or whatever as long as they aren't necessary. :)
 

Sim

Forum Administrator
Staff member
Reaction score
534
A constant function is simply

JASS:
constant function MultiSlashDamage takes integer level returns real
    return 100.00 * 0 + level
endfunction
 

U are a noob

Mega Super Ultra Cool Member
Reaction score
152
BJS:
~~B~~ (7:27:14 PM): are bjs any slower than with out them?
~~A~~ (7:28:23 PM): Yes. But you'd have to call them a thousand times per second for 3+ days before your game would lag .016 seconds behind one that didnt.
~~A~~ (7:28:40 PM): Emjlr and I did the calculations. Ask him if you want.
~~A~~ (7:29:03 PM): When it comes to bjs, know which ones have memory leaks, and dont call those ones. The rest are fine.
 

elmstfreddie

The Finglonger
Reaction score
203
I know what BJs are n stuff, but still I don't like having them.
I only used 2 because I had to.
How do you make a unit a widget, I still need to know!!!

BTW uareanoob, my "Great GUIing" wouldn't go anywhere because I never make maps!!! If people need help in GUI, I help in GUI =/
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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