• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJASS] Spell problem, pausing a unit?

Status
Not open for further replies.
Level 4
Joined
Apr 7, 2012
Messages
63
This is a spell,Ice block. Its supposed to be similiar like crystal maidens frost cage thing. But it doesnt pause the unit neither does it even create the destructable around the unit. Its the first time I get to do with destructables and pausing so please help!

JASS:
scope IceBlock initializer Init
globals
      private constant integer ABI_ID = 'A000'
      private constant string EFFECT = "Abilities\\Weapons\\RedDragonBreath\\RedDragonMissile.mdl"
endglobals

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

private function Actions takes nothing returns nothing
    local unit hero = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()
    local player owner = GetTriggerPlayer()
    local real x = GetUnitX(target)
    local real y = GetUnitY(target)
    local integer pid = GetPlayerId(owner) + 1
    local integer lvl = GetUnitAbilityLevel(hero, ABI_ID)     
    local real damage = udg_StatsMentalPower[pid] * 0.75  
    local destructable d

    call UnitDamageTarget(hero, target, damage, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null) 
    call DestroyEffect(AddSpecialEffectTarget(EFFECT, target, "origin") ) 
    
    call ZTS_ApplyHealThreat( GetTriggerUnit(), GetSpellTargetUnit(), 75, true, true)
    
    call PauseUnit(target,true)
    set d = CreateDestructable('B00G' , x, y, 360, 1.0, 5)
    call TriggerSleepAction(4)
    call PauseUnit(target,false)
    call RemoveDestructable(d)
    
    set hero = null
    set target = null
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger IceBlockTrg = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( IceBlockTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( IceBlockTrg, Condition( function Conditions ) )
    call TriggerAddAction( IceBlockTrg, function Actions )
    call Preload(EFFECT)
endfunction
endscope
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
To pause units, you could give the unit an ability based on channel. Make it disable other abilities and set it to be not visible in command card.

Like Almia said, some effects disappear immediately when you destroy them. That is because they have no death animation. You can check the animations in the preview window on the left in WE, when you browse the effects.
 
Here are a few things to try:
  • First, double check the ID's of 'A000' and 'B00G' in the object editor, just to make sure that you have the correct ID's put in.
  • Second, try putting a debug message after the locals block. Cast the spell and see if you see the message. call BJDebugMsg("test")
  • JASS:
    local real damage = udg_StatsMentalPower[pid] * 0.75
    AFAIK global integer arrays default 0 but I could be wrong. If I am wrong, then it means that you may be using an uninitialized variable. (causing a thread crash) Try setting the variable to read local real damage = 50 and test it like that. If that works but the other version doesn't, then you have to make sure udg_StatsMentalPower[pid] has some value. (it could even be 0)
  • Try making the ZTS threat line a comment:
    JASS:
    //    call ZTS_ApplyHealThreat( GetTriggerUnit(), GetSpellTargetUnit(), 75, true, true)
    Then see if the destructable is created. Maybe that system is causing a problem with the trigger.
 
Status
Not open for further replies.
Top