• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

map not loading/spell not working

Level 3
Joined
Apr 29, 2024
Messages
25
The original code was very very long, and the damage used to bug out, the spell is meant to do 3 ticks of damage, but sometimes it would only do one tick of damage. So I decided to make a loop that uses a timer. I have been stuck on this for hours, the map does not load anymore. I dont know where the problem is, whether its my variables or syntax error or a trigger/function thats wrong etc. But it stopped working after I made the timer/loop, and changed actions function, so I know the problem is in one of those, if not both. Any help would be appreciated



JASS:
integer udg_FBB_ExecCount=0
timer udg_FBB_Timer=null
unit udg_MiddleB=null
unit udg_FBB_CAster=null
trigger gg_trg_Finger_Blitz_Barrage=null
trigger gg_trg_Quick_Attack=null

JASS:
function Trig_Finger_Blitz_Barrage_Conditions takes nothing returns boolean
    if(not(GetSpellAbilityId()=='A01K'))then
        return false
    endif
    return true
endfunction

function Trig_Finger_Blitz_Barrage_Func009001003 takes nothing returns boolean
    return(IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_FBB_CAster))==true)
endfunction

function Trig_Finger_Blitz_Barrage_Func009A takes nothing returns nothing
    call UnitDamageTargetBJ(udg_FBB_CAster, GetEnumUnit(), ((I2R(GetUnitAbilityLevelSwapped('A01K', udg_FBB_CAster))+3.00)*(0.70*I2R(GetHeroStatBJ(bj_HEROSTAT_INT, udg_FBB_CAster, true)))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endfunction

function Trig_Finger_Blitz_Barrage_Func088001003 takes nothing returns boolean
    return(IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_FBB_CAster))==true)
endfunction

function Trig_Finger_Blitz_Barrage_Func088A takes nothing returns nothing
    call UnitDamageTargetBJ(udg_FBB_CAster, GetEnumUnit(), ((I2R(GetUnitAbilityLevelSwapped('A01K', udg_FBB_CAster))+3.00)*(0.70*I2R(GetHeroStatBJ(bj_HEROSTAT_INT, udg_FBB_CAster, true)))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endfunction

function Trig_Finger_Blitz_Barrage_Func118001003 takes nothing returns boolean
    return(IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_FBB_CAster))==true)
endfunction

function Trig_Finger_Blitz_Barrage_Func118A takes nothing returns nothing
    call UnitDamageTargetBJ(udg_FBB_CAster, GetEnumUnit(), ((I2R(GetUnitAbilityLevelSwapped('A01K', udg_FBB_CAster))+3.00)*(0.70*I2R(GetHeroStatBJ(bj_HEROSTAT_INT, udg_FBB_CAster, true)))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
endfunction

function FBB_Timer takes nothing returns nothing
    set udg_FBB_ExecCount = udg_FBB_ExecCount + 1
    if udg_FBB_ExecCount > 3 then
        call PauseTimer(udg_FBB_Timer)
        call DestroyTimer(udg_FBB_Timer)
        call DisableTrigger(gg_trg_Quick_Attack)
        call SetUnitTimeScalePercent(udg_FBB_CAster, 100.00)
        set udg_FBB_Timer = null
        return
    endif
 
    set bj_wantDestroyGroup = true
    call ForGroupBJ(GetUnitsInRangeOfLocMatching(400.00, GetUnitLoc(udg_MiddleB), Condition(function Trig_Finger_Blitz_Barrage_Func009001003)), function Trig_Finger_Blitz_Barrage_Func009A)
    call AddSpecialEffectLocBJ(PolarProjectionBJ(GetUnitLoc(udg_MiddleB), GetRandomReal(0, 200.00), GetRandomDirectionDeg()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
    call AddSpecialEffectLocBJ(PolarProjectionBJ(GetUnitLoc(udg_MiddleB), GetRandomReal(0, 200.00), GetRandomDirectionDeg()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
    call AddSpecialEffectLocBJ(PolarProjectionBJ(GetUnitLoc(udg_MiddleB), GetRandomReal(0, 200.00), GetRandomDirectionDeg()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
    call AddSpecialEffectLocBJ(PolarProjectionBJ(GetUnitLoc(udg_MiddleB), GetRandomReal(0, 200.00), GetRandomDirectionDeg()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
endfunction

function Trig_Finger_Blitz_Barrage_Actions takes nothing returns nothing
set udg_FBB_CAster = GetTriggerUnit()
    call EnableTrigger(gg_trg_Quick_Attack)
    call SetUnitTimeScalePercent(udg_FBB_CAster, 300.00)
    set udg_MiddleB = CreateNUnitsAtLoc(1, 'h03A', GetOwningPlayer(udg_FBB_CAster), PolarProjectionBJ(GetUnitLoc(udg_MiddleB), 150.00, 45.00), 45.00)
    call SetUnitAnimation(udg_MiddleB, "death")
call UnitApplyTimedLifeBJ(3.00, 'BTLF', udg_MiddleB)
 
    set udg_FBB_ExecCount = 0
    set udg_FBB_Timer = CreateTimer()
    call TimerStart(udg_FBB_Timer, 1.0, true, function FBB_Timer)
endfunction

function InitTrig_Finger_Blitz_Barrage takes nothing returns nothing
set gg_trg_Finger_Blitz_Barrage=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Finger_Blitz_Barrage,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Finger_Blitz_Barrage,Condition(function Trig_Finger_Blitz_Barrage_Conditions))
call TriggerAddAction(gg_trg_Finger_Blitz_Barrage,function Trig_Finger_Blitz_Barrage_Actions)
endfunction

function Trig_Quick_Attack_Actions takes nothing returns nothing
call SetUnitAnimation(udg_FBB_CAster,"attack")
endfunction

function InitTrig_Quick_Attack takes nothing returns nothing
set gg_trg_Quick_Attack=CreateTrigger()
call DisableTrigger(gg_trg_Quick_Attack)
call TriggerRegisterTimerEventPeriodic(gg_trg_Quick_Attack,0.05)
call TriggerAddAction(gg_trg_Quick_Attack,function Trig_Quick_Attack_Actions)
endfunction
 
Last edited:

Uncle

Warcraft Moderator
Level 68
Joined
Aug 10, 2018
Messages
7,145
Can you post the GUI triggers? Seems like it'd be much easier to create and work with in GUI (this code is a mess).

Also, it'd be nice to explain what the ability does in detail, "the spell is meant to do 3 ticks of damage" doesn't really tell us anything about how it works. Describe it like an ability tooltip.
 
Level 3
Joined
Apr 29, 2024
Messages
25
I am new to all of this, so I dont really know where to see the GUI triggers for me to be able to post them. The ability is very inconsistent and its not always that it deals the full damage. So its pretty much RNG currently in the original code.

But heres a video of how the ability looks and what its supposed to do. You can see in the video that it deals damage every second, for 3 seconds. So it will deal damage 3 times in total. The bug makes it so it only deals damage once, and the other 2 times are ignored or non existent basically.
 

Attachments

  • Warcraft III Reforged 2024.05.24 - 20.27.23.01.mp4
    25.2 MB
Last edited:
Level 41
Joined
Feb 27, 2007
Messages
5,222
Alternate solution: Hero casts a fake, nonfunctional AoE spell based on Channel/Silence/whatever. Dummy cast Cluster Rockets from the source location to the target location for visuals. Dummy cast a Flamestrike on the target location for functional damage.
I am new to all of this, so I dont really know where to see the GUI triggers for me to be able to post them.
You have converted the trigger from GUI to see the full JASS (“convert to custom text” is the menu option you clicked). This doesn’t help you in working with it (you can’t revert this except by the Undo action) and it doesn’t make it easier for anyone else to read. In the future do this: How To Post Your Trigger
 

Uncle

Warcraft Moderator
Level 68
Joined
Aug 10, 2018
Messages
7,145
I am on reforged ver 1.36.1 I think its the newest ver currently
I think this should basically do the same thing as you see in the video (see the attached map below).

Note that since this uses a "channeled" ability the effects stop whenever you stop casting. That's how Cluster Rockets works and it made sense to do it this way. That being said, it could be modified to allow the caster to cancel the spell early and still have the periodic damage effects continue.

The triggers are relying on a Unit Indexer, which is a great system to have in your map, and is what makes this spell work regardless of the number of casters. Just make sure you don't import more than one Unit Indexer into your map and that you don't ever mess with a unit's custom value yourself. Those are the two requirements.

Don't do this!
  • Unit - Set the custom value of (Some unit) to 0
^ You can use an Array variable instead to accomplish the same thing.
 

Attachments

  • Blitz Barrage 1.w3m
    25.1 KB · Views: 4
Last edited:
Level 3
Joined
Apr 29, 2024
Messages
25
I see. It makes sense, thanks for the help unc and pyro. Those tutorial links are super helpful too
 
Level 12
Joined
May 7, 2008
Messages
346
Apologizes for intruding on the topic, but since I saw a discussion about Cluster Rockets I would like to add the following:

- Setting Cluster Rockets damage to 0 or 1 and then using the spell once it's either level 2 or 3 will freeze the game after maybe 3 or 4 spell casts.

This took me 2 months to figure out what was causing crashes in my previous project, so just keep that in mind if it happens to you as well!

Or alternatively, you can use Chopinski's Missile System.
 
Top