Spell Power Rage!

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
GetTiggeringUnit() wasn't working properly.

Why do you still have

Jass:
= CreateTimer()?
----------
Why is the group still in the struct?
----------
"thunderbolt" still isn't configurable.

I uploaded bad version.
Group >>Mixed global and struct data.

Also the "tunerbolt is there, well hidden but there :D
JASS:
private constant string MODEL1 = "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" //Model periodic.
private constant string MODEL2 = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" //Model at cast and at the end.
private constant string ORDER = "thunderbolt" //The stun order cast
 

WolfieeifloW

WEHZ Helper
Reaction score
372
You still don't need P to be an array though.
And the group should still be a global;
Not a struct member.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
Updating, I'll let you know that when I don't put timer t = CreateTimer()
It won't work.
Before updating, may I have your comments about that?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Create your timer before you start it.
With CSData I think it's:
JASS:
StartTimer

Or something.

You don't need that TriggerHappy (Unless it's a CSData specific thing) :rolleyes: .
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Again, I don't use CSData.
Read the documentation of it.
It will tell you how to create a timer.

EDIT: TimerUtils documentation tells you how (To create a timer for TimerUtils):
JASS:
//* set t=NewTimer()      : Get a timer (alternative to CreateTimer)

So I'm assuming CSData's documentation does too.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
It doesn't

Why can't I use timer t = CreateTimer()

a) It desyncs
b) It leaks
c) None of these answers, it's because: (you answer there)
 

WolfieeifloW

WEHZ Helper
Reaction score
372
I guess you can;
I just never have.
With TimerUtils you create the timer using the line stated above.

EDIT: Yeah, you can keep it I guess.
I'd make the switch to TimerUtils though.
 

BlackRose

Forum User
Reaction score
239
From the screenshot, it looks weird. Dust under him? Shouldn't it be on him? Though screenie is not very good. I'll test later.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
May someone aproove this code with TimerUtils before I make an update o_O

JASS:

scope PowerRage initializer Init

  globals
    private constant integer SPELL_ID = 'A000' //Id of the spell.
    private constant integer DUMMY_ID = 'h000' //Id of the dummy.
    private constant integer DUMMY_ABILITY_ID = 'A001' //Id of the dummy's spell.
    private constant integer FLY_ID = 'Arav' //What allows the caster to fly.
    private constant string MODEL1 = "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" //Model periodic.
    private constant string MODEL2 = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" //Model at cast and at the end.
    private constant string ORDER = "thunderbolt" //The stun order cast
    private constant real DAMAGE_MULTIPLIER = 75.00 //This amount will be multiplied by the level of the spell.
    private constant real OFFSET   = 20.00 //The speed of the caster.
    private constant real DTS = 25.00 //Distance to stop.
    private constant real HEIGHT_MODIFIER = 12.00 //The height multiplier, every time caster move, he's gain the real as  height.
    private constant attacktype AT = ATTACK_TYPE_NORMAL //Attack type.
    private constant damagetype DT = DAMAGE_TYPE_NORMAL //Damage type.
  endglobals
  
//=================================================================================\\
//===============DO NOT TOUCH BELOW HERE UNLESS YOU KNOW WHAT YOU DO!==============\\
//=================================================================================\\  
  globals
    private player array P
    private integer Index
    private unit Dummy
    private group Group = CreateGroup()
  endglobals

private struct data
    integer level
    integer change
    integer execs
    timer t = CreateTimer()
    unit caster
    real cx
    real cy
    real lx
    real ly
    real offset
    real angle
    real damage
    real height
    player owner
endstruct

private function Cond takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

private function GCond takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), P[Index])
endfunction

private function Callback takes nothing returns nothing
    local data d = GetTimerData(GetExpiredTimer())
    local real x
    local real y
    local real dx
    local real dy
    local unit u
    
    set d.offset = d.offset + OFFSET
    set x = d.cx + d.offset * Cos(d.angle * bj_DEGTORAD)
    set y = d.cy + d.offset * Sin(d.angle * bj_DEGTORAD)
    call SetUnitX(d.caster, x)
    call SetUnitY(d.caster, y)
    call DestroyEffect(AddSpecialEffect(MODEL1, x, y))
    set dx = d.lx - x
    set dy = d.ly - y
    set d.execs = d.execs + 1
    
    if d.execs < d.change then
        set d.height = d.height + HEIGHT_MODIFIER
        call SetUnitFlyHeight(d.caster, d.height, 0.00)
    elseif d.execs > d.change then
        set d.height = d.height - HEIGHT_MODIFIER
        call SetUnitFlyHeight(d.caster, d.height, 0.00)
    endif
    
    if SquareRoot(dx * dx + dy * dy) <= DTS then
        call PauseTimer(GetExpiredTimer())
        call DestroyTimer(GetExpiredTimer())
        call GroupEnumUnitsInRange(Group, d.lx, d.ly, 200.00, Condition(function GCond))
        call DestroyEffect(AddSpecialEffect(MODEL2, d.lx, d.ly))
        loop
            set u = FirstOfGroup(Group)
            exitwhen u == null
            set Dummy = CreateUnit(d.owner, DUMMY_ID, d.lx, d.ly, 0.00)
            call UnitAddAbility(Dummy, DUMMY_ABILITY_ID)
            call SetUnitAbilityLevel(Dummy, DUMMY_ABILITY_ID, d.level)
            call GroupRemoveUnit(Group, u)
            call IssueTargetOrder(Dummy, ORDER, u)
            call UnitApplyTimedLife(Dummy, 'BTLF', 1.00)
            call UnitDamageTarget(Dummy, u, d.damage, true, false, AT, DT, WEAPON_TYPE_WHOKNOWS)
        endloop
    endif

endfunction

private function Main takes nothing returns nothing
    local data d = data.create()
    local integer i = GetTriggerExecCount(GetTriggeringTrigger())
    local location l = GetSpellTargetLoc()
    local real range
    local real dx
    local real dy
    
    set d.caster = GetTriggerUnit()
    set Index = i
    set P[Index] = GetOwningPlayer(d.caster)
    set d.level = GetUnitAbilityLevel(d.caster, SPELL_ID)
    set d.cx = GetUnitX(d.caster)
    set d.cy = GetUnitY(d.caster)
    set d.lx = GetLocationX(l)
    set d.ly = GetLocationY(l)
    set dx = d.lx - d.cx
    set dy = d.ly - d.cy
    set range = SquareRoot(dx * dx + dy * dy)
    set d.change = R2I(range / OFFSET) / 2
    set d.execs = 0
    set d.angle = bj_RADTODEG * Atan2( d.ly - d.cy, d.lx - d.cx)
    set d.offset = 0.00
    set d.damage = DAMAGE_MULTIPLIER * I2R(GetUnitAbilityLevel(d.caster, SPELL_ID))
    set d.owner = GetOwningPlayer(d.caster)
    call DestroyEffect(AddSpecialEffect(MODEL2, d.cx, d.cy))
    call UnitAddAbility(d.caster, FLY_ID)
    call UnitRemoveAbility(d.caster, FLY_ID)
    call TimerStart( d.t, 0.02, true, function Callback)
    call SetTimerData( d.t, d)
    
    call RemoveLocation(l)
    set l = null
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function Cond))
    call TriggerAddAction(t,function Main)
endfunction
endscope
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
What is the error?

sec.

Undeclared function: NewTimer()
Code:
JASS:
scope PowerRage initializer Init

  globals
    private constant integer SPELL_ID = 'A000' //Id of the spell.
    private constant integer DUMMY_ID = 'h000' //Id of the dummy.
    private constant integer DUMMY_ABILITY_ID = 'A001' //Id of the dummy's spell.
    private constant integer FLY_ID = 'Arav' //What allows the caster to fly.
    private constant string MODEL1 = "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" //Model periodic.
    private constant string MODEL2 = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" //Model at cast and at the end.
    private constant string ORDER = "thunderbolt" //The stun order cast
    private constant real DAMAGE_MULTIPLIER = 75.00 //This amount will be multiplied by the level of the spell.
    private constant real OFFSET   = 20.00 //The speed of the caster.
    private constant real DTS = 25.00 //Distance to stop.
    private constant real HEIGHT_MODIFIER = 12.00 //The height multiplier, every time caster move, he's gain the real as  height.
    private constant attacktype AT = ATTACK_TYPE_NORMAL //Attack type.
    private constant damagetype DT = DAMAGE_TYPE_NORMAL //Damage type.
  endglobals
  
//=================================================================================\\
//===============DO NOT TOUCH BELOW HERE UNLESS YOU KNOW WHAT YOU DO!==============\\
//=================================================================================\\  
  globals
    private player array P
    private integer Index
    private unit Dummy
    private group Group = CreateGroup()
  endglobals

private struct data
    integer level
    integer change
    integer execs
    timer t = NewTimer()
    unit caster
    real cx
    real cy
    real lx
    real ly
    real offset
    real angle
    real damage
    real height
    player owner
endstruct

private function Cond takes nothing returns boolean
    return GetSpellAbilityId() == SPELL_ID
endfunction

private function GCond takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), P[Index])
endfunction

private function Callback takes nothing returns nothing
    local data d = GetTimerData(GetExpiredTimer())
    local real x
    local real y
    local real dx
    local real dy
    local unit u
    
    set d.offset = d.offset + OFFSET
    set x = d.cx + d.offset * Cos(d.angle * bj_DEGTORAD)
    set y = d.cy + d.offset * Sin(d.angle * bj_DEGTORAD)
    call SetUnitX(d.caster, x)
    call SetUnitY(d.caster, y)
    call DestroyEffect(AddSpecialEffect(MODEL1, x, y))
    set dx = d.lx - x
    set dy = d.ly - y
    set d.execs = d.execs + 1
    
    if d.execs < d.change then
        set d.height = d.height + HEIGHT_MODIFIER
        call SetUnitFlyHeight(d.caster, d.height, 0.00)
    elseif d.execs > d.change then
        set d.height = d.height - HEIGHT_MODIFIER
        call SetUnitFlyHeight(d.caster, d.height, 0.00)
    endif
    
    if SquareRoot(dx * dx + dy * dy) <= DTS then
        call PauseTimer(GetExpiredTimer())
        call DestroyTimer(GetExpiredTimer())
        call GroupEnumUnitsInRange(Group, d.lx, d.ly, 200.00, Condition(function GCond))
        call DestroyEffect(AddSpecialEffect(MODEL2, d.lx, d.ly))
        loop
            set u = FirstOfGroup(Group)
            exitwhen u == null
            set Dummy = CreateUnit(d.owner, DUMMY_ID, d.lx, d.ly, 0.00)
            call UnitAddAbility(Dummy, DUMMY_ABILITY_ID)
            call SetUnitAbilityLevel(Dummy, DUMMY_ABILITY_ID, d.level)
            call GroupRemoveUnit(Group, u)
            call IssueTargetOrder(Dummy, ORDER, u)
            call UnitApplyTimedLife(Dummy, 'BTLF', 1.00)
            call UnitDamageTarget(Dummy, u, d.damage, true, false, AT, DT, WEAPON_TYPE_WHOKNOWS)
        endloop
    endif

endfunction

private function Main takes nothing returns nothing
    local data d = data.create()
    local integer i = GetTriggerExecCount(GetTriggeringTrigger())
    local location l = GetSpellTargetLoc()
    local real range
    local real dx
    local real dy
    
    set d.caster = GetTriggerUnit()
    set Index = i
    set P[Index] = GetOwningPlayer(d.caster)
    set d.level = GetUnitAbilityLevel(d.caster, SPELL_ID)
    set d.cx = GetUnitX(d.caster)
    set d.cy = GetUnitY(d.caster)
    set d.lx = GetLocationX(l)
    set d.ly = GetLocationY(l)
    set dx = d.lx - d.cx
    set dy = d.ly - d.cy
    set range = SquareRoot(dx * dx + dy * dy)
    set d.change = R2I(range / OFFSET) / 2
    set d.execs = 0
    set d.angle = bj_RADTODEG * Atan2( d.ly - d.cy, d.lx - d.cx)
    set d.offset = 0.00
    set d.damage = DAMAGE_MULTIPLIER * I2R(GetUnitAbilityLevel(d.caster, SPELL_ID))
    set d.owner = GetOwningPlayer(d.caster)
    call DestroyEffect(AddSpecialEffect(MODEL2, d.cx, d.cy))
    call UnitAddAbility(d.caster, FLY_ID)
    call UnitRemoveAbility(d.caster, FLY_ID)
    call TimerStart( d.t, 0.02, true, function Callback)
    call SetTimerData( d.t, d)
    
    call RemoveLocation(l)
    set l = null
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t,Condition(function Cond))
    call TriggerAddAction(t,function Main)
endfunction
endscope
 
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