First Shot at a "Dash" Spell

substance

New Member
Reaction score
34
> 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?

Oh yeh, I forgot that function uses locations and not reals. Well I think the formula for getting the distance from 2 sets of coordiantes is
JASS:
SquareRoot((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y))
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> I opened it up and when I look at a JASS trigger, there's no highlighting and there's no Syntax Checker.

No idea. Have you checked the menus that you said you can see? Everything enabled? How about posting a screenshot of what you do see?

As for the location, you might be able to use this:

JASS:
native Location                 takes real x, real y returns location
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
help1fc4.png


help2jt1.png


help3rz9.png


Anything supposed to be checked?
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
JASS:
//**********************
//* Constant Functions *
//**********************

constant function FW_Rawcode takes nothing returns integer
  return 'A002' // This is the Raw Code for the spell "Flamewalk" (Based on Shockwave)
endfunction

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

function FW_Check takes nothing returns boolean
  return GetSpellAbilityId() == FW_Rawcode()
endfunction

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

function PolarX takes real x, real dist, real angle returns real
           return x+dist*Cos(angle*bj_DEGTORAD)
endfunction

function PolarY takes real y, real dist, real angle returns real
           return y+dist*Sin(angle*bj_DEGTORAD)
endfunction

function FW takes nothing returns nothing
  //Local Variables
    local timer t = GetExpiredTimer()
    local unit caster = GetHandleUnit(t, "caster")
    local real x = GetUnitX(caster)
    local real y = GetUnitY(caster)
    local location casterpos = Location(GetUnitX(caster), GetUnitY(caster))
    local location point = GetSpellTargetLoc()
            
  //Functions
    if DistanceBetweenPoints(casterpos, point) != 0 then
      call SetUnitPosition(caster, PolarX(x, DistanceBetweenPoints(casterpos, point)+30.00, AngleBetweenPoints(casterpos, point)), PolarY(y, DistanceBetweenPoints(casterpos, point)+10.00, AngleBetweenPoints(casterpos, point)))
    else
      call PauseUnit(caster, false)
      call ResetUnitAnimation(caster)
    endif     
    
  //Null Variables
    set caster = null
    call RemoveLocation(point)
    set point = null 
endfunction

function FW_Cast takes nothing returns nothing
  //Local Variables
    local timer t = CreateTimer()
    local unit caster = GetTriggerUnit()
            
  //Set Variables
    call SetHandleHandle(t, "caster", caster)
       
  //Functions
    call SetUnitAnimation(caster, "attack")
    call PauseUnit(caster, true)
    call TimerStart(t, 0.05, true, function FW)
    call TriggerSleepAction(2.0)
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    
  //Null Variables
    set t = null
    set caster = null
endfunction
    
//===========================================================================
function InitTrig_Flamewalk takes nothing returns nothing
local integer i
    set gg_trg_Flamewalk = CreateTrigger(  )
    loop
    exitwhen i>12
      call TriggerRegisterPlayerUnitEventSimple(gg_trg_Flamewalk, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT)
      set i=i+1
    endloop
    call TriggerAddCondition( gg_trg_Flamewalk, Condition(function FW_Check))
    call TriggerAddAction( gg_trg_Flamewalk, function FW_Cast )
endfunction


Here's the current script. It still doesn't work. It's crashing.
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
If NewGen is crashing on you, I can't even begin to imagine what your problem is...
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
... Just make sure it is installed in the folder that NewGen comes with. Just follow the instructions really....


EDIT: nvm. I just save, cause NewGen has never crashed on me, and it does a good job of finding the errors.
 

elmstfreddie

The Finglonger
Reaction score
203
JASS:
call TriggerAddAction( gg_trg_Flamewalk, function FW_Cast )


JASS:
function FW_Cast takes nothing returns nothing
  //Local Variables
    local timer t = CreateTimer()
    local unit caster = <b>GetTriggerUnit()</b>
            
  //Set Variables
    call SetHandleHandle(t, &quot;caster&quot;, caster)
       
  //Functions
    call SetUnitAnimation(caster, &quot;attack)
    call PauseUnit(caster, true)
    call TimerStart(t, 0.05, true, function FW)
    call TriggerSleepAction(2.0)
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    
  //Null Variables
    set t = null
    set caster = null
endfunction
    
<b>endfunction</b>


Explain to me how that is supposed to work :p

(I intended to bold foney things but that didn't work o_O)
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
Check up the posts a little more, I posted the updated the version of my script. Please check that out.
 

substance

New Member
Reaction score
34
Here ya go :

JASS:
globals
 constant integer FW_Rawcode = &#039;A002&#039;
endglobals

function FW_Check takes nothing returns boolean
 return GetSpellAbilityId() == FW_Rawcode
endfunction

function FW takes nothing returns nothing
 local timer t = GetExpiredTimer()
 local unit caster = GetHandleUnit(t, &quot;caster&quot;)
 local location target = GetSpellTargetLoc()
 local real x = GetUnitX(caster)
 local real y = GetUnitY(caster)
 local real x2 = GetLocationX(target)
 local real y2 = GetLocationY(target)
 local real angle = 3.14159/180.0 * Atan2(y2 - y, x2 - x)
 local real distance = SquareRoot((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y))

    if distance != 0 then
       call SetUnitPosition(caster, x + 30.0 * Cos(angle * 3.14159/180.0), y + 10.0 * Sin(angle * 3.14159/180.0))
    else
       call PauseUnit(caster, false)
       call ResetUnitAnimation(caster)
    endif     
    
    set caster = null
    call RemoveLocation(target)
    set target = null
//  set t = null **I dont know if you would have to set t to null here...   
endfunction

function FW_Cast takes nothing returns nothing
 local timer t = CreateTimer()
 local unit caster = GetTriggerUnit()
            
    call SetHandleHandle(t, &quot;caster&quot;, caster)       
    call SetUnitAnimation(caster, &quot;attack&quot;)
    call PauseUnit(caster, true)
    call TimerStart(t, 0.05, true, function FW)
    call TriggerSleepAction(2.0)
    call FlushHandleLocals(t)
    call DestroyTimer(t)
    
    set t = null
    set caster = null
endfunction
    
//===========================================================================
function InitTrig_Flamewalk takes nothing returns nothing
 local integer i = 0
 
    set gg_trg_Flamewalk = CreateTrigger()
    loop
       exitwhen i&gt;12
       call TriggerRegisterPlayerUnitEventSimple(gg_trg_Flamewalk, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT)
       set i=i+1
    endloop
    call TriggerAddCondition( gg_trg_Flamewalk, Condition(function FW_Check))
    call TriggerAddAction( gg_trg_Flamewalk, function FW_Cast )
endfunction


Should work.
 

substance

New Member
Reaction score
34
I'm getting: "Expected End of Line" in many places. :p

If you're using the JASS NEWGEN PACK it should compile fine, I just tested it. If you dont wanna use it then just go back to using constant function for getting the abilityID and it'll work in regular WE too.
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
OMG! This JASS stuff is really starting to make me quit........ugh........whenever I try to load this up on NewGen, it gives me an error and when warcraft iii opens, it goes to the main menu.

What's the best way to learn JASS? This is getting annoying.
 

substance

New Member
Reaction score
34
OMG! This JASS stuff is really starting to make me quit........ugh........whenever I try to load this up on NewGen, it gives me an error and when warcraft iii opens, it goes to the main menu.

What's the best way to learn JASS? This is getting annoying.

Haha, you better get on those tutorials! Lucky for you there are a TON on these forums. I would suggest the GUI to JASS tutorials to get started.
 

Sooda

Diversity enchants
Reaction score
318
In post #23 uncheck mark from "Disable vJASS Syntax". That should enable vJASS syntax check. When you go into main menu while testing your map in New Gen then it means there are syntax errors (What means vJASS syntax check didn' t ran at all. I have encountered same problem many time. Usually helps to save map twice. Then with other save syntax check kicks in.).
Right now it seems that your vJASS syntax check is disabled and you have to uncheck that mark to enable it.
 

emjlr3

Change can be a good thing
Reaction score
395
ever heard of my Dash tutorial???

yea...search it up
 

WarLuvr3393

Hmmm...too many things to play (WoW, COD4, WC3)
Reaction score
54
Eh, but you used the caster system and it's so hard to understand it with your "Table" stuff.
 

emjlr3

Change can be a good thing
Reaction score
395
i didnt use the caster system, i used a cache system, which is required for it to work well and MUI, until vJASS came along
 
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