| 01-05-2008, 03:44 PM | #1 |
I'm trying to make a summoning spell that does two things: 1. Makes the summoned unit permanent 2. Destroys any other copies of the summoned unit Here's the code: JASS:function Trig_Minion_Summon_Actions takes nothing returns nothing local real x = GetUnitX(GetSummonedUnit()) local real y = GetUnitY(GetSummonedUnit()) local integer i = GetUnitTypeId(GetSummonedUnit()) call SetWidgetLife( udg_DemonologistMinion, 0.00) call SetWidgetLife(GetSummonedUnit(), 0.00) call PolledWait(1.0) call CreateUnit(GetOwningPlayer(GetSummonedUnit()),i,x,y,270.0) call SetUnitAnimation( GetLastCreatedUnit(), "birth" ) set udg_DemonologistMinion = GetLastCreatedUnit() endfunction The units become permanent (by destroying the summoned unit and creating a new one of the same type), but it won't kill any doubles of the unit (set as the variable udg_DemonologistMinion). My code is intended to set the permanent unit (the one that is created instead of summoned) as the variable udg_DeomonologistMinion, then destroy it every time. But it's not doing that. |
| 01-05-2008, 04:00 PM | #2 |
Why not just base your spell off of Summon Misha? |
| 01-05-2008, 07:32 PM | #4 |
@ Alevice Good point, but I want to make 3 spells on the same hero that work like this, so that wouldn't work out so well. @Need_O2 Yup, that did it. It's not really a system, it's more just a gameplay feature. Thanks for help. |
| 01-05-2008, 08:39 PM | #5 |
Summon Misha, Summon Bear, Summon Feral Spirit. Duration set to zero for second two. Problem solved, I think. EDIT: The problem is that GetLastCreatedUnit doesn't actually work - it doesn't do what it says on the tin. It's a GUI thing. The GUI create unit function sets the last created unit to the variable it returns. So set the unit to a local as you make it. |
