HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

simple question (i hope)

09-27-2003, 09:07 PM#1
ayla
Okay, so I have a spell that summons 2 units when it casts, and I want to make a trigger that deletes one of them. I've tried something like

event: a unit casts a spell

condition: ability being casted is equal to <ability>

action: remove (last created unit) from the game

but that doesn't seem to work.
09-27-2003, 09:28 PM#2
Das Jank
Just alter the spell so it only summons one. Im thinking your talking about feral spirit and it can be changed in the Ability Editor to only summon 1 instead of two.
09-27-2003, 09:28 PM#3
35263526
why do you want to delete one? Why not just set the spell to only summon one?
I think created unit doesn't work when refering to summoned units (might be wrong though)
09-27-2003, 09:32 PM#4
ayla
Because of the editor bug at high levels. Its a spell based off serpant ward, that summons better wards each level, all the way up to level 7. But levels 5-7 won't work unless I change the default number of of summoned units (1) to 2 or more, so I thought the easiest way to fix it would be to just have all of the levels summon 2 wards, and have a trigger that deleted one of them each time.
09-27-2003, 09:33 PM#5
saus
I think there's an event response called Last Summoned Unit.
09-27-2003, 09:41 PM#6
ayla
If there is, I don't see it... theres a "summoned unit" (which doesn't work either), but theres no "last created summoned unit" that I can see.
09-27-2003, 10:29 PM#7
35263526
I don't think you can do that. Its because summoned units are created simultaneusly. So even if your trigger worked, it would either destroy them both or destroy neither.
09-27-2003, 10:32 PM#8
ayla
god i hate this editor and all of its bugs
09-27-2003, 10:49 PM#9
saus
You could make the spell do nothing, but then make it summon the unit using a trigger.
09-27-2003, 10:54 PM#10
35263526
Yes, that would be easiest. Except, their is no way for a trigger to check the casted spells's level. If you are only using 1 unit EVER that has the spell, you could make a seperate trigger that finds out when the spell is leveled up and adds 1 to an interger variable, then use if/then/else actions on your summoning trigger for each level.
09-27-2003, 11:58 PM#11
saus
You could do it with a couple people casting it too. It would take variables and maybe arrays but it would work.
09-28-2003, 04:50 AM#12
Mr.Obliteration
Reffering to last created unit only selects the last unit made with the trigger 'creat unit' If you wish to create only 1 unit from a spell, you either have to tell the spell to create only 1 unit, or do something like this:
Event: Units finishes casting an ability
Condition: Ability being cast == "ability"
Action:
Pick every unit of type "creature" owned by "player {
if(number of units of type "creature" is greater than 1) {
removed picked unit
}
}
This will only work if the ability allows you to only have 1 creature of that type, period.