• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Delay the effect of spell (JASS)

Level 5
Joined
Feb 22, 2025
Messages
78
Was trying to modify the Frozen Orb (by ECCHO), Changed the model of the orb to Sindragosa. Regarding that the Sindragosa SPX has the birth animation of 2 sec and that her frost breath falls in front of her, my question would be is there a way to delay the effect of missiles spawning on the ground( since they are attached to the origin of the orb model) as well to move them to match the landing of the frost breath effect, so that matches visually and area damage wise. Also if the orb model would to spawn behind the caster which changes should be made?

I suppose that this is the section for orb/missile relation


  • set this.obj = CreateUnit(p, XE_DUMMY_UNITID, x, y, rad*bj_RADTODEG)
    • call UnitAddAbility(this.obj, XE_HEIGHT_ENABLER)
    • call UnitRemoveAbility(this.obj, XE_HEIGHT_ENABLER)
    • call SetUnitFlyHeight(this.obj, z, 0)
    • call SetUnitScale(this.obj, scale, scale, scale)
    • call SetUnitAnimationByIndex(this.obj, 90)
    • call UnitRemoveAbility(this.obj, 'Aatk')
    • set this.art = AddSpecialEffectTarget(art, this.obj, "origin")
    • set this.sx = x
    • set this.sy = y
    • set this.xvel = speed*Cos(rad)
    • set this.yvel = speed*Sin(rad)
 

Attachments

  • IMG_7466.mp4
    19.4 MB
Level 29
Joined
Sep 26, 2009
Messages
2,595
I took a short look at that spell's script. Basically you face two separate issues:
  1. How to delay start of frozen orb
  2. How to match location of frozen orb to where Sindragosa frost breath hits.

Ad 1:
The spell starts from this part of the script:
JASS:
private function Evaluate takes nothing returns boolean
    if (GetSpellAbilityId() == ABILITY_ID) then
        call spell.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
    endif
    return false
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Filter(function Evaluate))
endfunction
When unit casts the orb spell, an instance of "spell" struct is created. The "spell" struct handles orb creation, its movement, etc.
So what you need to do is to delay call of call spell.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY()) by however long it takes for Sindragosa to appear.
You could use timers, but if this spell is supposed to be MUI/MPI, you will need additional structs or arrays to keep track of casts that are delayed.


Ad 2:
You won't be able to achieve it the way you have it. You use Sindragosa's model for the Orb, which is the center location for the Frozen Orb effects, so your hands are tied.
What you can do is to separate Sindragosa and the Orb: Set Orb's model to some invalid/invisible model and create a separate special effect/unit that uses Sindragosa's model in a location that is offset from Orb's location. You will need to test yourself which angle and how big distance it has to be, so that Sindragosa's breath hits the location where Frozen Orb is.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
I think, Nichilus, that 1 really is a best use-case for a Wait. It won't be exactly precise but that sloppiness comes with extreme ease-of-use to get an approximate solution. Since conditions cannot have waits in them you must slightly alter these functions:
JASS:
globals
    private constant real CAST_DELAY = 0.75
endglobals

private function Evaluate takes nothing returns nothing
    if (GetSpellAbilityId() == ABILITY_ID) then
        call TriggerSleepAction(CAST_DELAY) //either of these could be used
        call PolledWait(CAST_DELAY) //they each have advantages and disadvantages
        call spell.create(GetTriggerUnit(), GetSpellTargetX(), GetSpellTargetY())
    endif
endfunction

private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(t, function Evaluate)
endfunction
 
Top