Failed Attempt in vJASS

SFilip

Gone but not forgotten
Reaction score
634
OK, but my point is that replacing constants does not make it more efficient.
 

cleeezzz

The Undead Ranger.
Reaction score
268
alright, replaced 20 with 0.34906

JASS:
scope Spread

private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == 'A00D' or GetSpellAbilityId() == 'A006'
endfunction

private function Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local location Cast_Point = GetSpellTargetLoc()
    local real x = GetUnitX(Caster)
    local real y = GetUnitY(Caster)
    local real x1 = GetLocationX(Cast_Point)
    local real y1 = GetLocationY(Cast_Point)
    local real Angle = Atan2(y1 - y, x1 - x)
    local real px1 = x + 256 * Cos(Angle + 0.34906)
    local real py1 = y + 256 * Sin(Angle + 0.34906)
    local real px2 = x + 256 * Cos(Angle - 0.34906)
    local real py2 = y + 256 * Sin(Angle - 0.34906)
    local unit Dummy = CreateUnit(GetOwningPlayer(Caster), 'h001', x, y, 0)
    call UnitApplyTimedLife(Dummy, 'BTLF', 4.00 )
    call SetUnitAbilityLevel(Dummy, 'A009', GetUnitAbilityLevel(Caster, GetSpellAbilityId()) )
    call IssuePointOrder(Dummy, "breathoffrost", px1, py1)
    call IssuePointOrder(Dummy, "breathoffrost", px2, py2)
    call RemoveLocation(Cast_Point)
    set Caster = null
    set Cast_Point = null
    set Dummy = null
endfunction

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

endscope

alright, im assuming thats done :p

i have a few questions, why isn't the Shake function Private? (everything else is)
and after i call StartTimer, how do i do actions when the timer expires (without a new trigger perhaps?)
questions for the trigger in my previous post.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
alright, replaced 20 with 0.34906

JASS:
scope Spread

private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == 'A00D' or GetSpellAbilityId() == 'A006'
endfunction

private function Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local location Cast_Point = GetSpellTargetLoc()
    local real x = GetUnitX(Caster)
    local real y = GetUnitY(Caster)
    local real x1 = GetLocationX(Cast_Point)
    local real y1 = GetLocationY(Cast_Point)
    local real Angle = Atan2(y1 - y, x1 - x)
    local real px1 = x + 256 * Cos(Angle + 0.34906)
    local real py1 = y + 256 * Sin(Angle + 0.34906)
    local real px2 = x + 256 * Cos(Angle - 0.34906)
    local real py2 = y + 256 * Sin(Angle - 0.34906)
    local unit Dummy = CreateUnit(GetOwningPlayer(Caster), 'h001', x, y, 0)
    call UnitApplyTimedLife(Dummy, 'BTLF', 4.00 )
    call SetUnitAbilityLevel(Dummy, 'A009', GetUnitAbilityLevel(Caster, GetSpellAbilityId()) )
    call IssuePointOrder(Dummy, "breathoffrost", px1, py1)
    call IssuePointOrder(Dummy, "breathoffrost", px2, py2)
    call RemoveLocation(Cast_Point)
    set Caster = null
    set Cast_Point = null
    set Dummy = null
endfunction

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

endscope

alright, im assuming thats done :p


questions for the trigger in my previous post.

You can make Shake private if you want. It doesn't really matter as long as there isn't another function named "shake". So yeah, it might be wise to make it private.

And when using "TimerStart(...)" the timer will start first, run the amount of time you specified, then the actions in the "callback" will be run. All executions after the "TimerStart(...)" function won't perform after the specified time though.

If you specified "true" for the "periodic" input, then it will keep running, and it will call the "callback" function after each expiration. ;)
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
JASS:
native TimerStart           takes timer whichTimer, real timeout, boolean periodic, code handlerFunc returns nothing


Code Handlerfunc

So you would do something like this for example:
JASS:
globals
    integer i = 0 
endglobals

function Callback takes nothing returns nothing
    local timer t =  GetExpiredTimer()    //retrieves the timer that expired
    set i = i + 1
    if i >= 50 then
        call PauseTimer(t) //will stop the timer
        call DestroyTimer(t) //destroys the timer
    endif
    set t = null
endfunction

function JASS takes nothing returns nothing
    local timer t = CreateTimer()
    call TimerStart(t,0.05,true,function Callback) //starts the timer
//Starts timer "t"
//Runs the function "Callback" every 0.05 seconds
//It is periodic because of the "true"
//It runs to function "Callback" because of the "function Callback" argument
    set t = null
endfunction
 
Reaction score
456
The same would happen if you removed the t nulling and return line from the if. :)
 

cleeezzz

The Undead Ranger.
Reaction score
268
Handlerfunc

ooh thats what thats for..

ok i tried this

JASS:
scope HA

private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == 'A00C' or GetSpellAbilityId() == 'A00W'
endfunction

private function Shake takes nothing returns nothing
    call CameraSetEQNoiseForPlayer( GetOwningPlayer(GetEnumUnit()), 50.00 )
endfunction

private function Fire takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local real px = x + Offset * Cos(Angle) 
    local real py = y + Offset * Sin(Angle)
    if Offset <= Offset_Max then
        call IssuePointOrder(Dummy, "flamestrike", px, py)
        set Offset = Offset + 250
    else
        call PauseTimer(t)
        call DestroyTimer(t)
        set t = null
        set Dummy = null        
    endif
endfunction
    
private function Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local location Caster_Loc = GetUnitLoc(Caster)
    local real x = GetUnitX(Caster)
    local real y = GetUnitY(Caster)
    local location Cast_Point = GetSpellTargetLoc()
    local real x1 = GetLocationX(Cast_Point) 
    local real y1 = GetLocationY(Cast_Point)
    local real Angle = Atan2(y1 - y, x1 - x)          
    local group Shake_Group = GetUnitsInRangeOfLocAll(4000.00, Caster_Loc)
    local unit Dummy = CreateUnit(GetOwningPlayer(Caster),'h000', x, y, 0)
    local unit Dummy2 = CreateUnit(GetOwningPlayer(Caster),'h000', x, y, 0)
    local real Offset = 250.
    local real Offset_Max = (1500 + ( 500 * GetUnitAbilityLevel(Caster, GetSpellAbilityId()))) 
    local timer t = CreateTimer ()

    call ForGroup(Shake_Group, function Shake )
    call DestroyGroup(Shake_Group)
            
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", x, y ))
    call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl", x , y ))
    call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", x, y ))

    call TerrainDeformRipple ( x, y, 2000, 60, 4, 20, 1000.00 , 0.5 , 500.00 , true)
    call SetUnitState(Caster, UNIT_STATE_LIFE, GetUnitState(Caster, UNIT_STATE_MAX_LIFE))
            
    call UnitApplyTimedLife(Dummy,'BTLF',7)
    call SetUnitAbilityLevel(Dummy, 'A00A', GetUnitAbilityLevel(Caster, GetSpellAbilityId()))
            
    call TimerStart( t, 0.27, true, function Fire )
    
    call UnitApplyTimedLife(Dummy2,'BTLF',5)
    call SetUnitAbilityLevel(Dummy2, 'A001', GetUnitAbilityLevel(Caster, GetSpellAbilityId()))
    call IssuePointOrder(Dummy2, "shockwave", x1 , y1 )
    call RemoveLocation(Cast_Point)
    call RemoveLocation(Caster_Loc)
    call DestroyTimer(Holy_Arrow_Timer)
    set Caster = null
    set Dummy2 = null
endfunction

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

endscope

few issues though, since the variables are local, they dont carry over to the Fire function, should i make them global? (if not, how should i?)
 

cleeezzz

The Undead Ranger.
Reaction score
268
well i guess i tested myself.

JASS:
scope HA

globals
    real x
    real y
    real x1
    real y1
    real px
    real py
    real Angle
    unit Dummy
    real Offset
    real Offset_Max
endglobals


private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == 'A00C' or GetSpellAbilityId() == 'A00W'
endfunction

private function Shake takes nothing returns nothing
    call CameraSetEQNoiseForPlayer( GetOwningPlayer(GetEnumUnit()), 50.00 )
endfunction

private function Fire takes nothing returns nothing
    local timer t = GetExpiredTimer()
    set px = x + Offset * Cos(Angle) 
    set py = y + Offset * Sin(Angle)
    if Offset <= Offset_Max then
        call IssuePointOrder(Dummy, "flamestrike", px, py)
        set Offset = Offset + 250
    else
        call PauseTimer(t)
        call DestroyTimer(t)
        set t = null
        set Dummy = null        
    endif
endfunction
    
private function Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local location Caster_Loc = GetUnitLoc(Caster)   
    local location Cast_Point = GetSpellTargetLoc()  
    local group Shake_Group = GetUnitsInRangeOfLocAll(4000.00, Caster_Loc)
    local unit Dummy2 = CreateUnit(GetOwningPlayer(Caster),'h000', x, y, 0)
    local timer t = CreateTimer ()

    set x = GetUnitX(Caster)
    set y = GetUnitY(Caster)
    set x1 = GetLocationX(Cast_Point) 
    set y1 = GetLocationY(Cast_Point)
    set Angle = Atan2(y1 - y, x1 - x)  
    set Offset = 250.
    set Offset_Max = (1500 + ( 500 * GetUnitAbilityLevel(Caster, GetSpellAbilityId())))
    set Dummy = CreateUnit(GetOwningPlayer(Caster),'h000', x, y, 0) 
    
    call ForGroup(Shake_Group, function Shake )
    call DestroyGroup(Shake_Group)
            
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", x, y ))
    call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl", x , y ))
    call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", x, y ))

    call TerrainDeformRipple ( x, y, 2000, 60, 4, 20, 1000.00 , 0.5 , 500.00 , true)
    call SetUnitState(Caster, UNIT_STATE_LIFE, GetUnitState(Caster, UNIT_STATE_MAX_LIFE))
            
    call UnitApplyTimedLife(Dummy,'BTLF',7)
    call SetUnitAbilityLevel(Dummy, 'A00A', GetUnitAbilityLevel(Caster, GetSpellAbilityId()))
            
    call TimerStart( t, 0.27, true, function Fire )
    
    call UnitApplyTimedLife(Dummy2,'BTLF',5)
    call SetUnitAbilityLevel(Dummy2, 'A001', GetUnitAbilityLevel(Caster, GetSpellAbilityId()))
    call IssuePointOrder(Dummy2, "shockwave", x1 , y1 )
    call RemoveLocation(Cast_Point)
    call RemoveLocation(Caster_Loc)
    set Caster = null
    set Dummy2 = null
endfunction

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

endscope

and it works, not sure if its MUI though.

EDIT: does it clash with spreadshot? cuz suddenly both dont work.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      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