JASS spell help ;/

B

botanic

Guest
Sorry i added this in the wrong area clicked wrong button ;/


Im trying to modify the Dash_Strike_Image_Damage and the Dash_Strike_Target_Damage from Level * a number to using the AGI of the hero... I tried doing

JASS:
constant function Dash_Strike_Target_Damage takes real Level returns real
    return Level * I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, udg_Shapeshifter_Hero, true)) //Damage done to the target
endfunction


however it gives me an error ;/

I know the I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, udg_Shapeshifter_Hero, true)) is fine because i used it in a spell earlier however it seems that im missing something ~.~ Works great without trying to base the damage off the AGI...

IF you want the spell script it is:

JASS:
constant function Dash_Strike_SpellId takes nothing returns integer
    return 'A01H' //Rawcode of the ability being cast
endfunction

function Dash_Strike_DummyID takes nothing returns integer
    return 'n00H' //Rawcode for the Dash Dummy unit
endfunction

function Dash_Strike_Distance takes nothing returns real
    return 1.3 //Distance out related to the total distance between the target and caster
endfunction

constant function Dash_Strike_Target_Damage takes real Level returns real
    return Level * 50 //Damage done to the target
endfunction

constant function Dash_Strike_Image_Damage takes real Level returns real
    return Level * 50 //Damage done by the image movement
endfunction

constant function Dash_Strike_Image_Damage_Area takes real Level returns real
    return 50 + Level * 0 //Area of damage done by the image movement
endfunction

function Dash_Strike_Attack_Effect takes nothing returns string
    return "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl" //Effect on the caster when they attack the target
endfunction

function Dash_Strike_Attack_Effect_Location takes nothing returns string
    return "weapon" //Location of effect on the caster when they attack the target
endfunction

function Dash_Strike_Slide_Effect takes nothing returns string
    return "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" //Effect at the feat of the dummys as the dash
endfunction

//***************************************************\\

function Dash_Strike_Bezier_Curve takes real a, real b, real A, real B, real C  returns real
    return A*a*a+2*B*a*b+C*b*b 
endfunction

function Dash_Strike_MoveUnitToPolarProjection takes unit tomove, real dist, real angle returns nothing
    call SetUnitPosition(tomove, GetUnitX(tomove) + dist * Cos(angle * bj_DEGTORAD) , GetUnitY(tomove) + dist * Sin(angle * bj_DEGTORAD))
endfunction

function Dash_Strike_Fade_In takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = GetHandleUnit(t,"u")
    local integer i = GetHandleInt(t,"i")
    
    if i < 255 then
        call SetUnitVertexColor(u,255,255,255,i)
        set i=i+6
        call SetHandleInt(t,"i",i)
    else
        call PauseTimer(t)
        call FlushHandleLocals(t)
        call DestroyTimer(t) 
    endif

    set t = null
    set u = null
endfunction

function Dash_Strike_Fade_Out takes nothing returns nothing
    local timer t4 = GetExpiredTimer()
    local timer t = CreateTimer()
    local unit u = GetHandleUnit(t4,"u")
    local integer i = GetHandleInt(t4,"i")
    
    if i>0 then
        call SetUnitVertexColor(u,255,255,255,i)
        set i=i-6
        call SetHandleInt(t4,"i",i)
    else
        call PauseTimer(t4)
        call FlushHandleLocals(t4)
        call DestroyTimer(t4)
        call SetHandleHandle(t,"u",u)
        call SetHandleInt(t,"i",i)   
        call TimerStart(t, 0.01, true, function Dash_Strike_Fade_In)
    endif
        
    set u = null 
    set t = null   
    set t4 = null
endfunction

function Dash_Strike_Group takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(),bj_groupEnumOwningPlayer) and IsUnitType(GetFilterUnit(),UNIT_TYPE_GROUND)==true
endfunction

function Dash_Strike_Damage takes unit u, real r, real x, real y, real r2, boolean attack, boolean ranged, attacktype at, damagetype dt, weapontype wt returns nothing
    local group g = CreateGroup()
    local boolexpr b = Condition(function Dash_Strike_Group)
    local unit v

    set bj_groupEnumOwningPlayer = GetOwningPlayer(u)
    call GroupEnumUnitsInRange(g, x, y, r, b)
    call DestroyBoolExpr(b)    
    loop
        set v = FirstOfGroup(g)
        exitwhen v == null
        call GroupRemoveUnit(g,v)
        call UnitDamageTarget(u,v,r2,attack,ranged,at,dt,wt)
    endloop    
    call DestroyGroup(g)

    set g = null
    set b = null
endfunction

function Dash_Strike_Move3 takes nothing returns nothing
    local timer t3 = GetExpiredTimer()
    local unit u = GetHandleUnit(t3,"u")
    local unit dum3 = GetHandleUnit(t3,"dum3")
    local real lvl = GetHandleReal(t3,"lvl")
    local real angle = GetHandleReal(t3,"angle")
    local real dist = GetHandleReal(t3,"dist")    
    local real x2 = GetHandleReal(t3,"x2")
    local real y2 = GetHandleReal(t3,"y2") 
     
    call Dash_Strike_MoveUnitToPolarProjection(dum3,dist,angle)    
    call SetUnitAnimation(dum3, "walk")
    call DestroyEffect( AddSpecialEffect(Dash_Strike_Slide_Effect(),GetUnitX(dum3),GetUnitY(dum3)))
    call Dash_Strike_Damage(u,Dash_Strike_Image_Damage_Area(lvl), GetUnitX(dum3), GetUnitY(dum3), Dash_Strike_Image_Damage(lvl), false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
    if IsUnitInRangeXY(dum3,x2,y2, 50) then 
        call KillUnit(dum3)
        call RemoveUnit(dum3)        
        call PauseTimer(t3)
        call FlushHandleLocals(t3)        
        call DestroyTimer(t3)
    endif

    set t3 = null
    set u = null
    set dum3 = null
endfunction

function Dash_Strike_Move2 takes nothing returns nothing
    local timer t2 = GetExpiredTimer()
    local unit u = GetHandleUnit(t2,"u")
    local unit dum2 = GetHandleUnit(t2,"dum2")
    local real lvl = GetHandleReal(t2,"lvl")        
    local real x1 = GetHandleReal(t2,"x1")
    local real y1 = GetHandleReal(t2,"y1")
    local real x2 = GetHandleReal(t2,"x2")
    local real y2 = GetHandleReal(t2,"y2")
    local real x4 = GetHandleReal(t2,"x4")
    local real y4 = GetHandleReal(t2,"y4")    
    local real a = GetHandleReal(t2,"a") 
    local real b = 1-a 
    local real dum2x = Dash_Strike_Bezier_Curve(a,b,x1,x4,x2) 
    local real dum2y = Dash_Strike_Bezier_Curve(a,b,y1,y4,y2)           
    
    call SetUnitPosition(dum2,dum2x,dum2y)    
    call SetUnitAnimation(dum2, "walk")
    call DestroyEffect( AddSpecialEffect(Dash_Strike_Slide_Effect(),dum2x,dum2y))
    call Dash_Strike_Damage(u,Dash_Strike_Image_Damage_Area(lvl), dum2x, dum2y, Dash_Strike_Image_Damage(lvl), false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
    if IsUnitInRangeXY(dum2,x2,y2, 50) then 
        call KillUnit(dum2)
        call RemoveUnit(dum2)        
        call PauseTimer(t2)
        call FlushHandleLocals(t2)        
        call DestroyTimer(t2)
    endif    
    call SetHandleReal(t2,"a",a - .04)    
                                      
    set u = null
    set dum2 = null       
    set t2 = null
endfunction

function Dash_Strike_Move1 takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = GetHandleUnit(t,"u")
    local unit dum1 = GetHandleUnit(t,"dum1") 
    local real lvl = GetHandleReal(t,"lvl")       
    local real x1 = GetHandleReal(t,"x1")
    local real y1 = GetHandleReal(t,"y1")
    local real x2 = GetHandleReal(t,"x2")
    local real y2 = GetHandleReal(t,"y2")
    local real x3 = GetHandleReal(t,"x3")
    local real y3 = GetHandleReal(t,"y3")    
    local real a = GetHandleReal(t,"a") 
    local real b = 1-a 
    local real dum1x = Dash_Strike_Bezier_Curve(a,b,x1,x3,x2) 
    local real dum1y = Dash_Strike_Bezier_Curve(a,b,y1,y3,y2)           
    
    call SetUnitPosition(dum1,dum1x,dum1y)    
    call SetUnitAnimation(dum1, "walk")
    call DestroyEffect( AddSpecialEffect(Dash_Strike_Slide_Effect(),dum1x,dum1y))
    call Dash_Strike_Damage(u,Dash_Strike_Image_Damage_Area(lvl), dum1x, dum1y, Dash_Strike_Image_Damage(lvl), false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
    if IsUnitInRangeXY(dum1,x2,y2, 50) then 
        call KillUnit(dum1)
        call RemoveUnit(dum1)        
        call PauseTimer(t)
        call FlushHandleLocals(t)        
        call DestroyTimer(t)
    endif    
    call SetHandleReal(t,"a",a - .04)    
                                      
    set u = null
    set dum1 = null       
    set t = null
endfunction

function Trig_Dash_Strike_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local unit u2 = GetSpellTargetUnit()
    local timer t = CreateTimer() 
    local timer t2 = CreateTimer() 
    local timer t3 = CreateTimer()
    local timer t4 = CreateTimer() 
    local real lvl = GetUnitAbilityLevel(u, Dash_Strike_SpellId())  
    local real x1 = GetUnitX(u) 
    local real y1 = GetUnitY(u)         
    local real x2 = GetUnitX(u2) 
    local real y2 = GetUnitY(u2)    
    local real a = bj_RADTODEG * Atan2(y2 - y1, x2 - x1)
    local unit dum1 = CreateUnit(GetOwningPlayer(u), Dash_Strike_DummyID(), x1, y1, a)
    local unit dum2 = CreateUnit(GetOwningPlayer(u), Dash_Strike_DummyID(), x1, y1, a)
    local unit dum3 = CreateUnit(GetOwningPlayer(u), Dash_Strike_DummyID(), x1, y1, a)         
    local real length = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/Dash_Strike_Distance()  
    local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/2 
    local real dist2 = SquareRoot((dist*dist)+(length*length))   
    local real x3 = x1 + dist2 * Cos((a+45) * bj_DEGTORAD)  
    local real y3 = y1 + dist2 * Sin((a+45) * bj_DEGTORAD)
    local real x4 = x1 + dist2 * Cos((a+315) * bj_DEGTORAD) 
    local real y4 = y1 + dist2 * Sin((a+315) * bj_DEGTORAD)
    
    call SetHandleReal(t,"lvl",lvl)
    call SetHandleReal(t2,"lvl",lvl)
    call SetHandleReal(t3,"lvl",lvl)
    call SetHandleReal(t,"x1",x1) 
    call SetHandleReal(t,"y1",y1)
    call SetHandleReal(t,"x2",x2)
    call SetHandleReal(t,"y2",y2)
    call SetHandleReal(t2,"x1",x1) 
    call SetHandleReal(t2,"y1",y1)
    call SetHandleReal(t2,"x2",x2)
    call SetHandleReal(t2,"y2",y2)
    call SetHandleReal(t3,"x2",x2)
    call SetHandleReal(t3,"y2",y2)
    call SetHandleReal(t,"x3",x3) 
    call SetHandleReal(t,"y3",y3)
    call SetHandleReal(t2,"x4",x4) 
    call SetHandleReal(t2,"y4",y4)    
    call SetHandleReal(t,"a",1)
    call SetHandleReal(t2,"a",1)
    call SetHandleReal(t3,"angle",bj_RADTODEG * Atan2(y2 - y1, x2 - x1))
    call SetHandleReal(t3,"dist",SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/25)
    call SetHandleInt(t4,"i",255)      
    call SetHandleHandle(t,"dum1",dum1) 
    call SetHandleHandle(t2,"dum2",dum2)
    call SetHandleHandle(t3,"dum3",dum3)
    call SetHandleHandle(t,"u",u)
    call SetHandleHandle(t2,"u",u)
    call SetHandleHandle(t3,"u",u)
    call SetHandleHandle(t4,"u",u)        
   
    call SetUnitTimeScalePercent(dum1, 10000)
    call SetUnitAnimation(dum1, "walk")
    call SetUnitTimeScalePercent(dum2, 10000)
    call SetUnitAnimation(dum2, "walk")
    call SetUnitTimeScalePercent(dum3, 10000)
    call SetUnitAnimation(dum3, "walk")
    call ClearSelectionForPlayer(GetOwningPlayer(u))    
    call TimerStart(t, .025, true, function Dash_Strike_Move1) 
    call TimerStart(t2, .025, true, function Dash_Strike_Move2)
    call TimerStart(t3, .025, true, function Dash_Strike_Move3)
    call TimerStart(t4, .01, true, function Dash_Strike_Fade_Out)    
    call TriggerSleepAction(.4) 
    call SetUnitPosition(u,GetUnitX(u2),GetUnitY(u2))
    call SelectUnitAddForPlayer(u,GetOwningPlayer(u))
    if IsUnitAlly(u2,GetOwningPlayer(u))==false then   
        call IssueTargetOrder(u,"attack",u2)
        call UnitDamageTarget(u,u2,Dash_Strike_Target_Damage(lvl),false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
        call DestroyEffect(AddSpecialEffectTarget( Dash_Strike_Attack_Effect(), u , Dash_Strike_Attack_Effect_Location()))
    endif
    call TriggerSleepAction(2)  
    
    set t = null
    set t2 = null
    set t3 = null
    set t4 = null
    set u = null
    set u2 = null
    set dum1 = null
    set dum2 = null
    set dum3 = null    
endfunction

//===========================================================================
function Trig_Dash_Strike_Conditions takes nothing returns boolean  
    return GetSpellAbilityId() == Dash_Strike_SpellId()
endfunction

function InitTrig_Dash_Strike takes nothing returns nothing
    set gg_trg_Dash_Strike = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Dash_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Dash_Strike, Condition( function Trig_Dash_Strike_Conditions ) )
    call TriggerAddAction( gg_trg_Dash_Strike, function Trig_Dash_Strike_Actions )
endfunction
 

substance

New Member
Reaction score
34
Holy handle-vars that's alot of H2I!

Anyway, try
JASS:
return I2R(Level * GetHeroAgi(udg_Shapeshifter_Hero,true))


If you use the jass newgen pack it will be more descriptive in the errors that you get. It'll also allow you to use structs instead of all those slow, bug-prone handle vars calls.
 
B

botanic

Guest
Nope still get an error ;/

I attached a pict of the error box

I think it MIGHT be because the variable Shapeshifter_Hero is a global that I want to get the AGI from... (sometimes I get the constant being called from non-constant funcion error...)

PS: So SHOULD I fix the H2I? / How do i fix it?
 

Attachments

  • Picture 49.png
    Picture 49.png
    50 KB · Views: 214

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
YES. Fix the H2I stuff. It burns. I remember, though, that I used to be an H2I junkie, back in the good old days...

Structs mah man. Use structs. It's really too in depth for me to write a tutorial on now, but there are a few around that you should search for.
 
B

botanic

Guest
NE ways beyone cleaning the spell up anyone have any ideas on how/why I am having that problem? I also am having problems with another spell in the same way
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 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

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top