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

[System] MissileRecycler

I thought the ability should be removed before we can modify the fly height.
Btw, what do you think about adding delay parameter to RecycleMissile function? So that we can choose to remove the dummy immediately or not.

then why not use Flux' DummyRecycler ;)

or why not turn the Vertex ARGB of the dummy to 0, 0, 0, 0, since the appearance only resets when getting the recycled dummy
 
Removing the ability is only done for units who you can click on so their command card isn't weird. The only reason to remove it from a dummy is if the dummy has another ability sharing that order string. Likely never happened in all WC3 history.

The DEATH_TIME is a constant. It allows all standard missile death animations to pass in that span.
 
Level 10
Joined
May 24, 2016
Messages
339
Is this still an actual thing to use nowadays? I mean for 1.26 ofcource, since blah-blah reforged is banned for some countries.

@Bribe do you have some time to help a stupid one?

1) Can I myself modify GUI version of BPower's Missile system to recycle unit dummy? (I dunno, it seems it has no one and missile recycle might help it to improve perfomance)

2) As I got this system works just fine as much as dummyrecycler by Flux? What should be the best option considering the fact Im using Unit Indexer in my map?

3) Seems like Im still missing the point how this system works.
JASS:
GetRecycledMissile takes real x, real y, real z, real facing
seems to not take a unit id since it stores the one that created already. So do I able to use this function? As I digged in bpower's vjass missile I found this
JASS:
// Runs in createEx.
        //! textmacro MISSILE_RESET_ALL_MEMBERS
            set path = null
            set speed = 0.
            set acceleration = 0.
            set distance = 0.
            set dist = 0
            set dist = 0.
            set height = 0.
            set turn = 0.
            set open = 0.
            set collision = 0.
            set collisionType = 0
            set stackSize = 0
            set scaling = 1.
            set wantDestroy = false
            set recycle = false
        //! endtextmacro
  
        // Launches a dummy of your choice.
        static method createEx takes unit missileDummy, real impactX, real impactY, real impactZ returns thistype
            local thistype this = thistype.allocateNode()
            local real originX  = GetUnitX(missileDummy)
            local real originY  = GetUnitY(missileDummy)
            local real originZ  = GetUnitFlyHeight(missileDummy)
            //
            //! runtextmacro MISSILE_RESET_ALL_MEMBERS()
            //
            set origin = MissilePosition.create(originX, originY, originZ)
            set impact = MissilePosition.create(impactX, impactY, impactZ)
            call MissilePosition.link(origin, impact)
                      
            set posX      = originX
            set posY      = originY
            set x         = originX
            set y         = originY
            set z         = originZ
            set angle     = origin.angle
            set dummy     = missileDummy
          
            call SetUnitFlyHeight(missileDummy, originZ, 0.) 
            call SaveUnitHandle(HASH, this, GetHandleId(missileDummy), missileDummy)
            //
            static if LIBRARY_ErrorMessage then
                debug call ThrowWarning(GetUnitTypeId(missileDummy) == 0, "Missile", "createEx", "missileDummy", this, "Invalid missile dummy unit ( null )!")
            endif
            debug set launched = false
            return this
        endmethod


// Wrapper to createEx
static method create takes real x, real y, real z, real angle, real distance, real impactZ returns thistype
            local real impactX = x + distance*Cos(angle)
            local real impactY = y + distance*Sin(angle)
            // Get the dummy unit.
            //! runtextmacro MISSILE_GET_DUMMY_FROM_LIBRARY()
        endmethod



static if LIBRARY_MissileRecycler then
                return createEx(GetRecycledMissile(x, y, z, angle*bj_RADTODEG), impactX, impactY, impactZ) // TOLD YOU SO - this function seems to me as an example of using simple create unit event

I may just be an amateur, but for me it looks like as a simple create unit function.
 
Last edited:
Level 43
Joined
Feb 27, 2007
Messages
5,432
(I dunno, it seems it has no one and missile recycle might help it to improve perfomance)
The vast majority of performance bottlenecks in missile systems is from checking for collisions; the number of possible collisions to check scales strongly with W (number of walled surfaces or targets to collide with) and M (number of existing missiles) since each needs to be checked against everything else. Specifically (W+M)! which can be fucking massive.

I realize that most of the time missiles colliding with other missiles is not something anyone uses, but it's where everything bogs down. Recycling dummies would not make any noticeable difference in such a system.
 
Level 10
Joined
May 24, 2016
Messages
339
MissileRecycler is designed only to work with Vexorian/Anitarf/InFrane's dummy.mdx model file, so usually you just have one dummy unit type for that. I don't know about BPower's Missile enough to advise further.
thx you. I'm still curious how to use your system anyway

There are 2 functions:

JASS:
function GetRecycledMissile
        takes real x, real y, real z, real facing
            returns unit

    function RecycleMissile
        takes unit u
            returns nothing

As I believe, I can call GetRecycledMissile to get the avaliable dummy for furhter manipulations. It actually leads in eventually giving UnitApplyTimedLife, but am I able to use that with recycled missile and moreover, should I actually use apply timed life? Or maybe I should start a timer with timedlife real to then call RecycleMissile? Still seems to be a bad option of using.
 
The purpose of the system is to both recycle units as well as to allow their facing angle to be correct (not always perfectly) when it spawns, making it good for arrow projectiles but irrelevant for something that doesn't have a direction (such as phoenix fire).

If you are getting cases where the missiles are getting overloaded and killed/created too often, you can increase the constant variable ANG_STORAGE_MAX to something higher than 12 depending on how many of those dummies are exceeding the limit.
 
Level 10
Joined
May 24, 2016
Messages
339
The purpose of the system is to both recycle units as well as to allow their facing angle to be correct (not always perfectly) when it spawns, making it good for arrow projectiles but irrelevant for something that doesn't have a direction (such as phoenix fire).

If you are getting cases where the missiles are getting overloaded and killed/created too often, you can increase the constant variable ANG_STORAGE_MAX to something higher than 12 depending on how many of those dummies are exceeding the limit.
Thx you. I'm kinda confused how tricky dummy recycling is. That has been said that system uses indexed angles, configuravle via ANG... Oh my gosh I cant undestand it, I have read an instruction 2 times already.


Yeah it seems like Im getting it. Dummies retain the angle, and when it comes to another missile, the system picks the dummy that has the most close angle position to desirable so it uses that dummy with a little delay for dummy to turn if needed.

Well anyway. It seems like I modified BPower's missile GUI system and has given it recycling via replacing "CreateUnit" with "GetRecycledDummy" and replacing "RemoveUnit" with "Recycle Missile". Oh my god, is that would really be enough to implement? Im testing it out, works fine for now.
 
Top