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

[Solved] Creating Illusion from killed unit

Status
Not open for further replies.
Level 6
Joined
Oct 1, 2012
Messages
166
Heloes Hive Workshop

I have an idea for a skill, but not much any for making it work. The idea is, there's a skill, which makes a unit create illusions from every killed unit for as long, as the buff works (that is, 30 seconds).

Let me show you the script:

JASS:
//Manipulator - Spectre Army
    if UnitHasBuffBJ(killer, 'B017') then
     set dummy = GroupPickRandomUnit(CreateNUnitsAtLoc(1, 'e003', player, GetUnitLoc(killed), 0))
     set item = CreateItemLoc('I02S', GetUnitLoc(dummy)) 
     call UnitAddItem(dummy, item)
     call UnitUseItemTarget(dummy, przedmiot, killed)
    endif

Okay now. I know it leaks - it's just a minute part of kinda big trigger, no leaks when it's complete.

The idea is, when a hero uses his skill he gets a buff, namely the 'B017'. As you can see, when he kills a unit, the dummy unit is created (I know 'FIrstOfGroup' would be better, but I got used to 'GroupPickRandomUnit' and copy+paste it everywhere :D ). Afterwards, the dummy gets an item, 'I02S', that is my version of Illusion Wand, which can target dead. For now everything is okay, but then... Illusion spell creates a copy of the target with EXACT SAME AMMOUNT OF HP, which is 0. So, my illusions die instantly :D

Any ideas how to fix it? I want the illusions to have 100% hp (they take 3x hits and hit 30% anyway). Maybe some kind of 'last created unit' but corresponding to a unit just summoned? I'd be glad for any help!

@EDIT: I had the idea to set unit's hp to 100% just after summoning, but it doesn't seem to work.
 
Level 6
Joined
Oct 1, 2012
Messages
166
Pretty genious. Stupid of me to not think about it. Thanks, works as it should :)
 
Status
Not open for further replies.
Top