question about call UnitDamageTarget

cleeezzz

The Undead Ranger.
Reaction score
268
i see triggers use Debug messages but i dont really know how to use them.

you call the debug function but how do you make it show the debug text?
 

Kenny

Back for now.
Reaction score
202
You call:

JASS:
call BJDebugMsg("your string")


so you can use it in the onDestroy method like:

JASS:
call BJDebugMsg("Spell ended")


and stuff like that. I just makes sure that a certain part of the spell actually functions and runs when it should.

*EDIT*

I have a new suspicion after reading your message, and it also has to do with the SafeX and SafeY functions. I copied them from a map made by someone a long time ago and i think he may have had it wrong. Ill get back to you in one sec. Well i just found the map, and i cant find anything wrong with them except for the parenthesis. It isnt wrong but maybe remove them...
 

cleeezzz

The Undead Ranger.
Reaction score
268
ugh, i havent touched WE in forever, and when i did it crashes with a runtime error. something about microsoft visual C++

edit: just found out by searching, its cuz of newgen and 1.22


anyway,

can anyone see the definite problem in the code =/


edit: oh and without newgen, how the heck are we supposed to save vJass?.... downgrading is lame.
edit: nvm thanks kc (Still need help with the original question above.
edit: tested SafeX and SafeY without parenthesis, same result.

HUH? i used debug messages and guess what. the numbers were changing ?? how is that possible

JASS:
scope SA initializer InitTrig

globals
    // Configurables:
    private constant integer Abil_id = 'A011'  // Your spells raw code
    private constant integer Unit_id = 'h00J'  // Your dummy unit
    private constant real Period = 0.04        // Interval on the periodic timer
    private constant real Start_dist = 10.00   // Don't worry about this really, distance dummy unit starts away from the hero, i guess you would want this low
    private constant real Radius = 25.00       // Radius obviously
    private constant real Scale = 1            // Scale size of the arrow
    private constant real Fly_height = 60.00   // Fly height of the arrow
    private constant attacktype A_type = ATTACK_TYPE_CHAOS
    private constant damagetype D_type = DAMAGE_TYPE_UNIVERSAL
    private unit Caster
endglobals

//=======================================================================
private function Damage takes integer lvl returns real
    return 133.33+(66.66*lvl)
endfunction

private function Max_dist takes integer lvl returns real
    return 333.33+(666.66*lvl) 
endfunction

function CustomFilter takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(Caster)) and GetWidgetLife(GetFilterUnit())>0.405
endfunction



//=======================================================================
private struct SAD
    timer t
    unit cast
    unit dummy
    real castx
    real casty
    real targx
    real targy
    real Move_dist
    real dist = Start_dist
    real angle
    integer level
    group Group1 = CreateGroup()
    group Group2 = CreateGroup()
   
    static method create takes nothing returns SAD
        local SAD data = SAD.allocate()
        local location targ = GetSpellTargetLoc()
        set data.cast = GetTriggerUnit()
        set data.castx = GetUnitX(data.cast)
        set data.casty = GetUnitY(data.cast)
        set data.targx = GetLocationX(targ)
        set data.targy = GetLocationY(targ)
        set data.angle = AngleXY(data.castx,data.casty,data.targx,data.targy)
        set data.Move_dist = 44.00
        set data.level = GetUnitAbilityLevel(data.cast,Abil_id)
        set Caster = data.cast
       
        set data.dummy = CreateUnit(GetOwningPlayer(data.cast),Unit_id, PolarProjectionX (data.castx, Start_dist, data.angle), PolarProjectionY (data.casty, Start_dist, data.angle) , data.angle)
        call SetUnitPathing(data.dummy,false)
        call SetUnitScale(data.dummy,Scale,Scale,Scale)
        call SetUnitFlyHeight(data.dummy,Fly_height,0.00)
       
        call RemoveLocation(targ)
        set targ = null
        return data
    endmethod
   
    private method onDestroy takes nothing returns nothing
        call KillUnit(.dummy)
        call GroupClear(.Group1)
        call DestroyGroup(.Group1)
        call ReleaseTimer(.t)
    endmethod
endstruct

//=======================================================================
private function Move takes nothing returns nothing
    local SAD data = GetCSData(GetExpiredTimer())
    local unit u
    local real x = GetUnitX(data.dummy)
    local real y = GetUnitY(data.dummy)
   
    set data.dist = data.dist + data.Move_dist
    if data.dist >= Max_dist(data.level) then
        call data.destroy()
        return
    endif
    call BJDebugMsg(R2S(x))
    call BJDebugMsg(R2S(y))   
    set x = PolarProjectionX(x, data.Move_dist, data.angle)
    set y = PolarProjectionY(y, data.Move_dist, data.angle)
    call BJDebugMsg(R2S(x))
    call BJDebugMsg(R2S(y))

    call SetUnitX(data.dummy, x)
    call SetUnitY(data.dummy, y)
    call GroupClear(data.Group2)
    call GroupEnumUnitsInRange(data.Group2,SafeX(x),SafeY(y),Radius,Condition(function CustomFilter))
        loop
            set u = FirstOfGroup(data.Group2)
            exitwhen u == null
            if not(IsUnitInGroup(u,data.Group1)) then
                call GroupAddUnit(data.Group1,u)
                call UnitDamageTarget(data.cast,u,Damage(data.level),false,false,A_type,D_type,null)
                call GroupRemoveUnit(data.Group2,u)
            endif
                call GroupRemoveUnit(data.Group2,u)
        endloop
endfunction
   
//=======================================================================
private function Actions takes nothing returns nothing
    local SAD data = SAD.create()
   
    set data.t = NewTimer()
    call TimerStart(data.t,Period,true,function Move)
    call SetCSData(data.t,data)
endfunction

//=======================================================================
private function Conditions takes nothing returns boolean
    return GetSpellAbilityId()== Abil_id
endfunction


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

endscope

as you can see it tells me the x and y, then the polar projection of x and y, but the weird thing is it keeps changing??? how can it change, the x and y are constant since the dummy NEVER moves. it cant be safex and safey anymore, cuz if it was, all it would do is keep the unit in hte same place and that would mean x and y would be constant. but i get a huge list of different numbers.
 

cleeezzz

The Undead Ranger.
Reaction score
268
maybe ill just create a new thread, the question is not relevant to the title + its old.
 
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

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top