• 🏆 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!

[JASS] Problem with crow form

Status
Not open for further replies.
Level 10
Joined
Sep 29, 2006
Messages
447
okay so i made a spell called force choke (yes, like darth vader) and basically what it does is lift a unit off the ground and deal damage over time, then sets it back on the ground after 4 seconds. everything works except that if a hero dies while suspended, when it revives, it stays in the air. how do i fix this? my trigger adds crow form, raises the unit, waits 4 seconds, puts the unit down, and removes crow form. so how can i get it so that when a unit revives it is not suspended anymore?

here's my script:

JASS:
function Trig_force_choke_JASS_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A028'
endfunction

function Trig_force_choke_JASS_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local unit dummy
    local unit TempUnit = GetSpellTargetUnit()
    local location TempPoint = GetUnitLoc(TempUnit)
    call PauseUnit( TempUnit, true )
    call UnitAddAbility( TempUnit, 'Amrf' )
    call SetUnitFlyHeight( TempUnit, 120.00, 60.00 )
    set dummy = CreateUnitAtLoc( GetOwningPlayer(caster), 'h005', TempPoint, 270.00 )
    call UnitAddAbility( dummy, 'A027' )
    call SetUnitAbilityLevel( dummy, 'A027', GetUnitAbilityLevel(caster, 'A028') )
    call IssueTargetOrder( dummy, "drain", TempUnit )
    call UnitApplyTimedLife( dummy, 'BTLF', 7.00 )
    call TriggerSleepAction( 4.00 )
    call SetUnitFlyHeight( TempUnit, 0.00, 160.00 )
    call UnitRemoveAbility( TempUnit, 'Amrf' )
    call PauseUnit( TempUnit, false )
    call RemoveLocation(TempPoint)
    set caster = null
    set TempUnit = null
    set dummy = null
endfunction

//===========================================================================
function InitTrig_force_choke_JASS takes nothing returns nothing
    set gg_trg_force_choke_JASS = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_force_choke_JASS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_force_choke_JASS, Condition( function Trig_force_choke_JASS_Conditions ) )
    call TriggerAddAction( gg_trg_force_choke_JASS, function Trig_force_choke_JASS_Actions )
endfunction
 
Level 10
Joined
Sep 29, 2006
Messages
447
im using a trigger to revive heroes.

here's the trigger if you need it:

JASS:
function Trig_revive_Conditions takes nothing returns boolean
    return IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true 
endfunction

function Trig_revive_Actions takes nothing returns nothing
    local timerdialog WINDOW
    local integer HEROWAIT
    local timer OURTIMER
    local unit OURHERO
    local location reviveloc
    set OURHERO = GetDyingUnit()
    set HEROWAIT = (GetHeroLevel(OURHERO)*5)
    set OURTIMER = CreateTimer()
    call TimerStart(OURTIMER, I2R(HEROWAIT), false, null)
    call CreateTimerDialogBJ(OURTIMER,GetPlayerName(GetOwningPlayer(OURHERO)))
    set WINDOW = GetLastCreatedTimerDialogBJ()
    call TimerDialogDisplayForPlayerBJ(true,WINDOW,GetOwningPlayer(OURHERO))
    call PolledWait(HEROWAIT)
    if ( IsPlayerAlly(GetOwningPlayer(OURHERO), Player(10)) ) then
      set reviveloc = GetRectCenter(gg_rct_Region_025)
      call ReviveHeroLoc(OURHERO,reviveloc,true)
      call RemoveLocation(reviveloc)
    endif
    if ( IsPlayerAlly(GetOwningPlayer(OURHERO), Player(11)) ) then
      set reviveloc = GetRectCenter(gg_rct_Region_026)
      call ReviveHeroLoc(OURHERO,reviveloc,true)
      call RemoveLocation(reviveloc)
    endif
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(OURHERO),GetUnitLoc(OURHERO),0.60)
    call DestroyTimerDialog(WINDOW)
endfunction

//===========================================================================
function InitTrig_revive takes nothing returns nothing
    set gg_trg_revive = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_revive, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_revive, Condition( function Trig_revive_Conditions ) )
    call TriggerAddAction( gg_trg_revive, function Trig_revive_Actions )
endfunction
 
Level 10
Joined
Sep 29, 2006
Messages
447
okay this is the trigger i came up with. i dont want to remove crow form from certain units because they have that ability thats the reason for the if/then/else. will this work?

will finishes reviving work with a triggered revival?

  • remove crow form on revival
    • Events
      • Unit - A unit Finishes reviving
    • Conditions
    • Actions
      • Animation - Change (Triggering unit) flying height to 0.00 at 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Not equal to Special Operative
          • (Unit-type of (Triggering unit)) Not equal to Special Operative (Flying)
        • Then - Actions
          • Unit - Remove Crow Form from (Triggering unit)
        • Else - Actions
 
Status
Not open for further replies.
Top