First Shot at a "Dash" Spell

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
Help me with my "Dash Spell"

Yep. This is the only way to learn...through trial and error. I was reading Daelin's guide on the knockback, but I tried my best to make it like a dash spell. Here's the code:

JASS:
//*************************************************************
//* Constant Functions (Only edit things under this section.) *
//*************************************************************
constant function FW_Raw_Code takes nothing returns integer
  return 'A003'
endfunction

//**************
//* Conditions *
//**************

function FW_Spell_Check takes nothing returns boolean
  return GetSpellAbilityId() == FW_Raw_Code()
endfunction

//*************
//* Functions *
//*************

function FW_Dash takes nothing returns nothing
  //Local Varibles and Handles
    local timer dashtimer = GetExpiredTimer()
    local unit caster = GetHandleUnit(dashtimer, "caster")
    local location casterpos = GetUnitLoc(caster)
    local real xtarget = GetHandleReal(dashtimer, "xtarget")
    local real ytarget = GetHandleReal(dashtimer, "ytarget")
    local location targetpoint = Location(xtarget, ytarget)
    local real dist = GetHandleReal(dashtimer, "dist")
    local real angle = AngleBetweenPoints(casterpos,targetpoint)
    local real X      = GetUnitX(caster)
    local real Y      = GetUnitY(caster)
    local real polarX = X + 75.00 * Cos(angle)  
    local real polarY = Y + 75.00 * Sin(angle)
         
  //Functions
    if GetHandleReal(dashtimer, "dist") >= 0.0 then //Cannot be exact.  Must go into negatives to take effect so weird distances can be detected
      call SetUnitPosition(caster,X,Y)
      call SetHandleReal(dashtimer, "dist", dist-75.00) //This is my indicator which will keep decreasing until it's below 0
      call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl", GetUnitX(caster), GetUnitY(caster)))
    else
      call PauseUnit(caster, false)
      call ResetUnitAnimation(caster)
      call SetUnitPathing(caster, false)
      call FlushHandleLocals(dashtimer)
    endif      
        
  //Null Variables
    set caster = null
    call RemoveLocation(casterpos)
    call RemoveLocation(targetpoint)
    set casterpos = null
    set targetpoint = null   
endfunction

function FW_Spell takes nothing returns nothing
  //Local Variables
    local unit caster = GetTriggerUnit()
    local timer dashtimer = CreateTimer()
    local location targetpoint = GetSpellTargetLoc()
    local real xtarget = GetLocationX(targetpoint)
    local real ytarget = GetLocationY(targetpoint)
    local real dist = DistanceBetweenPoints(GetUnitLoc(caster), targetpoint)
      
  //Handles
    call SetHandleHandle(dashtimer, "caster", caster)
    call SetHandleReal(dashtimer, "xtarget", xtarget)
    call SetHandleReal(dashtimer, "ytarget", ytarget)
    call SetHandleReal(dashtimer, "dist", dist)
       
  //Functions
    call PauseUnit(caster, true)
    call SetUnitAnimation(caster, "attack")
    call SetUnitPathing(caster, true)
    call TimerStart(dashtimer, 0.035, true, function FW_Dash)
    
  //Null Variables
    call ResetUnitAnimation(caster)
    call PauseTimer(dashtimer)
    call DestroyTimer(dashtimer)
    set dashtimer = null
    call FlushHandleLocals(dashtimer)
    set caster = null
    call RemoveLocation(targetpoint)
    set targetpoint = null
endfunction

//===========================================================================
function InitTrig_Flame_Walk takes nothing returns nothing
local integer i
    set i = 0
    set gg_trg_Flame_Walk = CreateTrigger(  )
    loop
      exitwhen i>12
      call TriggerRegisterPlayerUnitEventSimple( gg_trg_Flame_Walk, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT)
      set i = i + 1
    endloop
    call TriggerAddCondition( gg_trg_Flame_Walk, Condition(function FW_Spell_Check))    
    call TriggerAddAction( gg_trg_Flame_Walk, function FW_Spell )
    call Preload("Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl")
endfunction


I can't get this right. It worked before and now it doesn't work. Please help me correct this problem.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
JASS:
if DistanceBetweenPoints(x1,y1,x2,y2) != 0 then


What's going on here? The distance between points function should only be used with two points. It looks like you're trying to use 4.

JASS:
call SetUnitAnimation(caster, "attack)


You only have one quotation there.


JASS:
endfunction
    
endfunction


I don't think you need that second endfunction.

See if that helps any. :D
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
I hate to say this, but you should use vjass. It is guaranteed to work (if you code it right, that is). Handle vars and gamecache can bug if the person using them has a full gamecache file. That's why I love structs. I've always understood Jass, and Handle Vars, but Handle Vars suddenly stopped working for me one day (it bugged out). Structs are globals and therefore the pwn. Also, it is much easier to code with structs once you learn how to use them. To completely eliminate gamecache, you can use Cohadar's Struct Attachment System. But, yeah... it's just much easier.



You have an extra endfunction just above your InitTrig.


EDIT: CMON Ghan! Stop STEALING MY POSTS~! :p
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> CMON Ghan! Stop STEALING MY POSTS~!

Hey, don't look at me. You know way more JASS than I do. :p
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> 2 locations, 4 points.

But if you did that, wouldn't you have to convert the coordinates to locations first with the native Location function?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> What is JassNewGen Pack?

In reality, it is a hack of the WC3 system created by Vexorian that adds to the powers of the JASS coding language. You can find it on wc3campaigns.
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
I found it but i'm having a lot of trouble opening this up. Anyone help?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> i'm having a lot of trouble opening this up.

What kind of trouble? Have you found out how to unzip it?
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
I DL'd the program but it just opens the command script for .5 seconds then it closes. I don't know how to open the file.
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
EDIT: I got it I think.

So what will this program do for me?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> So what will this program do for me?

What you want it to do. Within the bounds of its capabilities, of course. :p Some interesting things that come with the New Gen pack are structs, libraries, and globals.
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
How do I access this? I opened WE up and I see the stuff at the top but I don't know how to use the syntax checker or the script highlightor thingy. Help?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
> I don't know how to use the syntax checker or the script highlightor thingy.

Create a JASS trigger.
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
I convert it to custom text and nothing is showing up. How do I get the high lightor thing and the syntax checker? This program is confusing me.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
Did you open up the WE from the New Gen file? Or did you open it normally? To get the enhancements, you have to open it from the New Gen folder that you unzipped.
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
I opened it with the cooler looking WE icon, the one that I extracted to a folder. I opened it up and when I look at a JASS trigger, there's no highlighting and there's no Syntax Checker. Well?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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