• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Create Corpse

Status
Not open for further replies.
Of the several methods to create a corpse none is stranger than the way to literally create a corpse; native CreateCorpse takes player whichPlayer, integer unitid, real x, real y, real face returns unit. However, if you want to create a permanent corpse you need;
JASS:
function CreatePermanentCorpseLocBJ takes integer style, integer unitid, player whichPlayer, location loc, real facing returns unit
    set bj_lastCreatedUnit = CreateCorpse(whichPlayer, unitid, GetLocationX(loc), GetLocationY(loc), facing)
    call SetUnitBlendTime(bj_lastCreatedUnit, 0)

    if (style == bj_CORPSETYPE_FLESH) then
        call SetUnitAnimation(bj_lastCreatedUnit, "decay flesh")
        call GroupAddUnit(bj_suspendDecayFleshGroup, bj_lastCreatedUnit)
    elseif (style == bj_CORPSETYPE_BONE) then
        call SetUnitAnimation(bj_lastCreatedUnit, "decay bone")
        call GroupAddUnit(bj_suspendDecayBoneGroup, bj_lastCreatedUnit)
    else
        // Unknown decay style - treat as skeletal.
        call SetUnitAnimation(bj_lastCreatedUnit, "decay bone")
        call GroupAddUnit(bj_suspendDecayBoneGroup, bj_lastCreatedUnit)
    endif

    call TimerStart(bj_delayedSuspendDecayTimer, 0.05, false, null)
    return bj_lastCreatedUnit
endfunction
What is so special about the started time, the unit group, and the blend time? What if i want a permanent corpse that doesn't go away, but works with Raise Dead, Animate Death, Resurrection, Cannibalize, and Pick Up Corpse?
What if i wanted to remove the corpse later from the game? What special things do i need to do to not cause errors?
 
Level 26
Joined
Aug 18, 2009
Messages
4,099
JASS:
function CreateCorpsePerm takes player p, integer unitid, real x, real y, real facing returns unit
    local unit u = CreateCorpse(p, unitid, x, y, facing)

    call UnitSuspendDecay(u, true)
    call SetUnitBlendTime(u, 0)
    call SetUnitAnimation(u, "decay bone")

    set udg_u = u
    
    set u = null
    
    return udg_u
endfunction
 
Status
Not open for further replies.
Top