• 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.

Random thoughts for dummy recycler

Status
Not open for further replies.
Level 12
Joined
May 22, 2015
Messages
1,051
Here is just some steps that I thought of that might make recycling dummies easy. I'd like to know if it would work and appreciate any input on it.

Setup:
1) Make a reincarnate ability with 0 cooldown and a defend ability that doesn't do anything.

2) Make a dummy unit. Give it the reincarnate ability and the defend ability.

3) Make a chaos ability that turns the unit into a dummy unit.

Main code ideas:
Some kind of spawnDummy(myPlayer, x, y) function that will allow getting dummies whether recycled or not. When it spawns one or takes a recycled one, it will order the dummy to defend.

I think there is a "stop defending" order that fires when a unit reincarnates. This allows me to capture when the dummy dies. It will reincarnate, and at this time, I can give it the chaos ability (my idea is to erase any abilities it has). Then I add it to the recycle stack.


I haven't actually used the reincarnate + defend trick to detect when a unit reincarnates and I haven't used the chaos ability for anything, so I am not certain if my ideas will work. I also don't know how efficient this code would be - hopefully better than making new dummies each time. Just some thoughts and I'd rather get some feedback before experimenting.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Since the defend ability doesn't do anything, how do you intente to use " stop defending " order?

I remember reading somewhere that a unit that dies or starts to reincarnate will be issued a "stop defending" order right as they die. This lets you set up a trigger like:
  • Dummy Died
  • Events
    • Unit - A unit is issued an order (with no target)
  • Conditions
    • Unit type of (Triggering unit) equal to Dummy Unit
    • Issued Order equal to "stop defending" // don't know the syntax for this part, but pretty sure it's possible.
  • Actions
    • // Recycle this unit
I haven't actually tested it, but I do remember reading it. I would need someone to confirm or to test it myself since I haven't used it before. It needs to reincarnate or I would need to use timers for all my dummies to tell them to recycle at the right time. It would just be super awesome if I could just do the same thing except replace the CreateUnit(...) with the new spawnDummy(...) function in my triggers that create dummies.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Or you could not kill your dummies and then use an existing dummy recycler.

Can you direct me to a good one? I should note that I like to write my own code because it is fun to learn. I do use good systems as reference, though, and I will credit the system creator if I use parts of their code or their ideas.
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
If you will use the dummy as a caster, you only need one. Create 1 at Map Initialization and assign a variable that points to it. Example:
JASS:
globals
    unit dummyCaster
endglobals

//Map Init
private function MapInit takes nothing returns nothing
    set dummyCaster = CreateUnit(...)
endfunction

...
function SomeFunction1 takes nothing returns nothing
    //...
    //Can be used with SetUnitOwner(dummyCaster, ...)
    call IssueTargetOrder(dummyCaster, "order", unit1, ...)
    //dummyCaster is never destroyed
    //...
    call IssueTargetOrder(dummyCaster, "order", unit2, ...)
endfunction

function SomeFunction2 takes nothing returns nothing
    //...
    call IssueTargetOrder(dummyCaster, "order", unit1, ...)
    //...
    call IssueTargetOrder(dummyCaster, "order", unit2, ...)
endfunction
^Will work fine


If you need the dummy units as attachment of effect,
MissileRecyler
Dummy


If you need to re-use a certain unit type (example you want to use a unit as an sfx with certain animation),
Dummy Reuser
 
Level 12
Joined
May 22, 2015
Messages
1,051
I feel like that would cause problems. The dummy needs to not have the abilities that I give it when I want it to cast stuff. It will have multiple spells with the same order string or might even have an aura or something.

It also would not work well with any kind of persistent effect, such as a lingering slow aura or DOT. It would move the aura around and would credit the wrong players with kills.
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
I feel like that would cause problems. The dummy needs to not have the abilities that I give it when I want it to cast stuff. It will have multiple spells with the same order string or might even have an aura or something.

It also would not work well with any kind of persistent effect, such as a lingering slow aura or DOT. It would move the aura around and would credit the wrong players with kills.

Forgot to mention that you use UnitAddAbility before the order. Then use UnitRemoveAbility after the order.

If you would attach an aura to it, then refer to my second suggestion. You still need to use SetUnitOwner.
 
Status
Not open for further replies.
Top