HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Tough trigger question....

11-22-2003, 02:02 AM#1
Kenstoth
Hey people, I have a question that's been bothering me for a while. Let me first say that I did not create the trigger for this spell, it was actually done by somebody on these forums of whom I have forgotten their name (if it's your trigger, let me know so I can give you credit). Now i'll get into what the spell is supposed to do.

I called this "Call Dragon," a unit casts a spell (I use war stomp), then a frost wyrm appears, swoops down and "picks up" the unit, and flys back up and then you have a frost wyrm rider. This works fine for the most part, but has quite a few bugs of which I need to fix for my map. Here's the trigger for calling the dragon, and having the dragon pick up the unit:

Unit - A unit owned by Player 4 (Purple) Begins casting an ability

(Ability being cast) Equal to War Stomp

Wait 2.00 seconds
Unit - Create 1 Doom Wyrm for Neutral Passive at ((Position of (Triggering unit)) offset by (1000.00, 0.00)) facing Default building facing degrees
Unit - Make (Last created unit) Invulnerable
Wait 0.50 seconds
Unit - Order (Last created unit) to Move To (Position of (Triggering unit))
Wait 0.50 seconds
Unit - Make (Last created unit) Vulnerable
Wait 0.50 seconds
Wait 0.50 seconds
Animation - Change (Last created unit) flying height to 5.00 at 400.00
Wait 0.50 seconds
Unit - Remove (Triggering unit) from the game
Unit - Change ownership of (Last created unit) to Player 4 (Purple) and Change color
Special Effect - Create a special effect attached to the chest of (Last created unit) using Myunits\Myunit.mdx
Set calldragonp4 = (Last created special effect)
Wait 0.50 seconds
Animation - Change (Last created unit) flying height to 240.00 at 400.00
Wait 0.50 seconds
Wait 0.50 seconds

I'll get into the bugs of this first and i'll label it #1 for easy answering ://// . There's really only one major bug. If two units cast war stomp at about the same time, 2 doom wyrms are created, but one stays still and never gets transfered to play 4 or anything below that, and the other one "picks up both the units," as in, both the units are removed, but only one gets the special effect added to it. I don't even know where to begin in fixing this. Here's the triggers form "landing," where, when the doom wyrm casts this spell, a new unit is created (it's a spirit walker) and the doom wyrm rides out a bit and then is removed.
Unit - A unit owned by Player 4 (Purple) Begins casting an ability

(Ability being cast) Equal to Big Bad Voodoo

Animation - Change (Triggering unit) flying height to 5.00 at 400.00
Wait 0.50 seconds
Special Effect - Destroy calldragonp4
Unit - Create 1 Spirit Walker for Player 4 (Purple) at (Position of (Triggering unit)) facing Default building facing degrees
Wait 0.50 seconds
Animation - Change (Transporting unit) flying height to 240.00 at 400.00
Wait 0.50 seconds
Unit - Order (Triggering unit) to Move To ((Position of (Triggering unit)) offset by (1000.00, 0.00))
Wait 2.00 seconds
Unit - Remove (Triggering unit) from the game

Okay, that works pretty well. A few things here though. Problem #2: When there are more than 1 doom wyrms, and you cast the big bad vodoo, the special effect plays the spirit walker's death animation SOUND, but the special effect doesn't actually dissapear, giving a very strange clone type thing. This probably has to do with the special effect variable, since it's not an array...but I wouldn't know how to use an array for that. Problem #3: I'm not exactly sure since it's been a couple days since I tested THIS problem out but I think if you have two of the doom wyrms casting BBV at about the same time, one spirit walker is created but not the second one.

All right, so I really hope someone can help me with this! Through my eyes, it looks like this is mostly organization problems with simple numbers. But I have no clue how to fix these. If someone could help, I would love them...or worship them, or neither, whichever you prefer :D
Thanks! Later.
11-23-2003, 03:01 AM#2
Kenstoth
All right, i'll just go into the realm of nothingness.
11-23-2003, 04:32 AM#3
SpectreReturns
Just use the old increasing/decreasing array, and set the units to the array instead of using (Last Created Unit)
11-23-2003, 11:23 AM#4
KaTTaNa
Another way do it:
Make two unit variables called Temp_Unit, and Temp_Unit2.

Custom script: local unit udg_Temp_Unit
Custom script: local unit udg_Temp_Unit2 = GetTriggerUnit()
(Create your wyrm)
set Temp_Unit = (Last created unit)
(Rest of the trigger here)

Now use Temp_Unit instead of (Last created unit) in the rest of the trigger, and Temp_Unit2 instead of (Triggering unit).
11-23-2003, 01:09 PM#5
Biflspud
Quote:
Originally posted by Kenstoth
All right, i'll just go into the realm of nothingness.


This is not a 24/7 answering service. You'll need to be a little more patient before giving up.

You got your answer, by the way, use an array.
11-23-2003, 02:30 PM#6
Kenstoth
Thanks guys, i'll try that. My only problem that I can see now is the special effect. I can make a variable for that, but then I how do I refer back to the right one?

And sorry Biflspud and others, I do get impatient at times :////

You guys are going to hate me, sorry for having to make another post...for some reason it's not letting me edit my post. I did it with variables, but there's still one minor problem. When more than 1 units cast war stomp at the same time, that number of dragons are created. But, only one follows the rest of the triggers. As in, the rest of them just stand there, while one picks up the unit who summoned it. The good thing is that this no longer picks up multiple units :D
11-23-2003, 02:37 PM#7
Biflspud
I'd wager the same way you reference the unit being picked up by the dragon - an array call.

Create an integer variable called something like DragonCounter. Whenever a unit begins casting the dragon riding ability:

Code:
Set dragoncounter = dragoncounter + 1
Create dragon at position of unit offset by x, y
Set dragonunit[dragoncounter] = last created unit
Set mountingunit[dragoncounter] = casting unit

<waits, dragon swoops in>

Remove mountingunit[1] from the game
Add special effect attached to chest of dragonunit [1] using model myunit.mdx
Now, you need to bump all of the other units in dragonunit and mountingunit down:
Code:
For each (Integer A) from 1 to dragoncounter, do (Actions)
    Loop - Actions
        Set mountingunit[dragoncounter] = mountingunit[(dragoncounter + 1)]
        Set dragonunit[dragoncounter] = dragonunit[(dragoncounter + 1)]
Set Dragoncounter = Dragoncounter - 1
If I forgot anything (like a special effect) you can remove it in this way, too.

Make sense? That way, you 're adding dragons and units to a "queue," and when you remove 'em, you're pulling the first one out of the pile, and bumping all the others down a rank (so #2 becomes #1, #3 becomes #2, etc).
12-01-2003, 12:31 AM#8
Kenstoth
Thanks for the help but that still didn't quite work. It works when only 1 unit casts the call dragon, but when two units cast it at about the same time, two dragons are created, one stays put, the other moves towards one of the two units. The one that moved lowers down, but doesn't "pick up" a unit. As in, no special effect is created, and the unit doesn't get removed. I can post the trigger I have if you need it.
12-04-2003, 10:32 PM#9
Kenstoth
Any suggestions? :WD:
12-05-2003, 09:23 AM#10
ABM
first of all i want to say that i suck with trigger, i mean i am quite a rookie to you or biflspud but still maybe what i will say can help you.....

here when two unit use same ability at same time it often mess up the trigger, so to prevent that use the turn off trigger turn on trigger ability.

ex:
Unit - A unit owned by Player 4 (Purple) Begins casting an ability

(Ability being cast) Equal to War Stomp

(turn off this trigger)
Wait 2.00 seconds
Unit - Create 1 Doom Wyrm for Neutral Passive at ((Position of (Triggering unit)) offset by (1000.00, 0.00)) facing Default building facing degrees
Unit - Make (Last created unit) Invulnerable
Wait 0.50 seconds
Unit - Order (Last created unit) to Move To (Position of (Triggering unit))
Wait 0.50 seconds
Unit - Make (Last created unit) Vulnerable
Wait 0.50 seconds
Wait 0.50 seconds
Animation - Change (Last created unit) flying height to 5.00 at 400.00
Wait 0.50 seconds
Unit - Remove (Triggering unit) from the game
Unit - Change ownership of (Last created unit) to Player 4 (Purple) and Change color
Special Effect - Create a special effect attached to the chest of (Last created unit) using Myunits\Myunit.mdx
Set calldragonp4 = (Last created special effect)
Wait 0.50 seconds
Animation - Change (Last created unit) flying height to 240.00 at 400.00
Wait 0.50 seconds
Wait 0.50 seconds
(turn on this trigger)

the only messy thing with this is that you have to wait lot of time beforer the player two can cast the spell. you will not be able to cast at same time (good) but you will have to wait long time (bad) so you will have to adjust the wait period or to put your trigger (turn on) (turn off) in a place it prevent both units from casting at same time but still allow units to wait the most little time before to cast ...


i don't know if i explain well but if you manage to do it your trigger will no more haver bug.:ggani:
12-05-2003, 12:27 PM#11
FerretDruid
You could try something like this.

Action - CASTER starts the effect of an ability

Condition - Ability being cast equal to Dragon Call
Condition - CASTER is not in ONLYONECASTER (unit group variable)

Action - Add CASTER to ONLYONECASTER
Action - If, Then, Else
Action - IF CASTER is in ONLYONECASTER
Action - THEN remove CASTER from ONLYONECASTER
Action - The rest of your actions here
Action - ELSE Do Nothing

I think that would work...