HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Adding any unit hit by Chain lightning to a unit group.

02-04-2004, 03:16 AM#1
Dalten
I'd like to add units that get hit by chain lightning to a unit group or a variable but I'm not sure it's possible.

Giving 20 pts for the answer how, you don't nessisarily have to create the trigger for me.
02-04-2004, 05:04 AM#2
Grater
A) It's impossible.

B) It's nearly impossible, but not quite, the "damage taken" from "Unit takes damage" event can be compared to the amount of damage dealth by CL on each bounce. Still, not a fun system of triggers to write and impratical if more than one unit can cast the CL spell at the same time.

C) You can fake CL using triggers, not that hard, easier if only at most one unit per player can cast the CL spell.
02-04-2004, 05:32 AM#3
Dalten
By faking, you mean

1) create a single target lightning spell
2) use triggers to randomly pick units near the target and then attack that unit too. By knowing what unit is getting attacked I'd also be able to put it into a variable.

Good so far..

But, how can i make the initial target or even the chained targets cast the spell on other units if they wouldn't have the single target ability themselves?

Btw it shouldn't be too hard to make it multi-user castable with arrays. So far my RPG has like 35 different Array type variables, i'm building it from the ground up to be as flexible as possible.
02-04-2004, 07:23 AM#4
Grater
Quote:
By faking, you mean

1) create a single target lightning spell
2) use triggers to randomly pick units near the target and then attack that unit too. By knowing what unit is getting attacked I'd also be able to put it into a variable.
Basically...
Quote:
But, how can i make the initial target or even the chained targets cast the spell on other units if they wouldn't have the single target ability themselves?
You dont, you use a hidden caster.
Quote:
Btw it shouldn't be too hard to make it multi-user castable with arrays. So far my RPG has like 35 different Array type variables, i'm building it from the ground up to be as flexible as possible.
Right, generally it's easy to do castable by multiple players, having multiple units of the same player cast is tricker (altough still by no means hard).


Getting back to the trigger:
(I'm going to assume this is a hero spell)
The spell the hero casts should be a single-target chain lightning (no bounce), also make a duplicate unit spells, one for each level of the hero spell - the hidden caster version should have no cooldown, no mana cost, and the hidden caster unit should have no casting delays (backswing) I reccomend basing the hidden caster off the flying sheep, for me it works superbly.

The trigger creates the hidden caster, hides it, gives it the appropriate lightning spell then basically moves the hidden caster from target to target, zapping the next target with waits as appropiate.

To ensure targets are not hit twice a unit group can be used to store previously hit targets.
02-04-2004, 08:48 AM#5
Cubasis
Yes, and to add to the discussion.

I have been inspecting the internal system of the chain lightning for some time now (for fun). And it seems it picks each unit that is closest to the currently bolted unit. But still the target unit must not have been hit before by the current chain lightning cast. That's do'able by collecting the units hit into a unit group.

Anyways

Cubasis
02-04-2004, 10:53 PM#6
Dalten
Ok i have a small problem thats driving me absolutely insane, if I figure this out i'll be home free.

Attached is my code so far.

My dummy caster is a Sorceress, with the Neutral hostile version of Chain LIghtning. It successfully identifies the caster and the initial target, as well as a random target in the unit group. BUT, i can do anything BUT make it so my unit will cast the chain lightning spell on the target.

I also tried this with a dummy Far seer, and made him Learn the Hero version of CHain Lightning right after he was created. But, once again, ordering him to chain lightning the random unit doesn't yield any results at all.

Any idea's what i'm doing wrong here?

Btw the random unit will pause, and the dummy unit(not invisible until i get it working) does follow the Target, Otherunit(2).

Am i missing something with the order string or something?
02-04-2004, 11:27 PM#7
cangrejo
Quote:
Originally posted by Cubasis40
I have been inspecting the internal system of the chain lightning for some time now (for fun). And it seems it picks each unit that is closest to the currently bolted unit. But still the target unit must not have been hit before by the current chain lightning cast. That's do'able by collecting the units hit into a unit group.


Is this error free? I'm gonna try make a cool spell :)

Edit: is the range after each bounce = the base range of chain lightning?
Edit: ahh no, it's the "Area of effect" that's the range after each bounce ;)
02-04-2004, 11:34 PM#8
linkmaster23
Yes, I have also inspected Chain Lightning... it seems by making the triggers just right, you can't even tell the difference... but, there is always the whole "Looks" effect to consider. Which has always been my top priority, if it don't look right, it isn't.

- Slayer -
02-04-2004, 11:46 PM#9
cangrejo
Quote:
Originally posted by Dalten
Am i missing something with the order string or something?


Why do you have a 2 second wait after you create dummy caster? don't you want it to make the spell immediately?
Edit: After reading a little more in ur trigger i realized it's kind of messed up..
I might help you in a while, but atm i'm caught up with making a cool chain ligtning based spell....
02-05-2004, 12:00 AM#10
Dinadan87
You orderred it to follow the target after you orderred it to cast the spell.
It takes a small amount of time to cast the spell, but the follow order came almost at the same time as the spell order, and it was done before the spell went off.
Rather then pausing and making it follow, you should wait until a bolt hits a unit, then move the dummy caster instantly the unit just hit and have him immediatly cast on the next target. Puasing a unit for 2 seconds while it waits for an invisible unit to walk to it its pretty inefficient, so each jump should have a wait, then a instant move, then a chain lightning command from the decoy, and then a wait for the next jump, and the dummy will keep teleporting from unit to unit casting the spell on another units.
02-05-2004, 12:12 AM#11
Narwanza
That is only going to work for like 2 targets. Also, you need to create a damage degrading aura to account for the damage subtraction on each bounce. Make sure it stacks. Here is what you need to do. Create a Unit with a lightning attack that has the initial amount of damage that you want done. Make the cooldown insanely high and the acquisition range to 0. Now make these two triggers. Oh, make sure that the dummy has no model, and is classified as an invulnerable,ancient. Then make the attack of the dummy unit only able to hit invulnerable ancients. Make sure you give the dummy the aura, and make sure the aura has a range that spreads as far as the chain lightning is going to go. Be sure it only targets Invulnerable Ancients. Make sure you remove the special art on the dummy units. And also one more thing, don't have your aura have an art.

Code:
Events:
Unit begins casting ability

Conditions:
Ability == chain lightning

Actions:
Set CASTINGUNIT = (casting unit)
Create 1 DUMMY UNIT for (casting player) at (position of (Casting unit))
facing default building degrees
Set DUMMYUNIT[BOUNCES(a real variable)] = last created unit
Custom script: call UnitAddAbility( 'aloc', (unit code) )
Order (DUMMYUNIT[BOUNCES]) to (attack) target unit of ability bieng cast)
The unit code can be obtained by going into the object editor and selecting your dummy unit. Then press ctrl + d and you will see something like h001 (dummy unit). The h001 would be the unit code. Find the unit code for your dummy unit and insert it in the proper place above.
Code:
Events:
Unit is attacked

Condition:
Attacking unit-type == Unit-type of dummy

Actions:
Set BOUNCES = BOUNCES + 1
Add attacked unit to ATTACKEDUNITS
Pick every unit owned by (owner of (attacked unit)) within (500) of CASTINGUNIT and add them to UNITSTOBEATTACKED
Remove ATTACKEDUNITS from UNITSTOBEATTACKED
Create 1 DUMMY UNIT for (owner of (attacking unit)) at (position of (attacked unit) facing whatever degrees
Set DUMMYUNIT[BOUNCES] = (last created unit)
Order (DUMMYUNIT[BOUNCES]) to (attack) (random unit from UNITSTOBEATTACKED)

I am pretty sure this would work. Please tell me if I left out something vital. All of the capitalized words are variables.
[edit] ooops, i did forget something. There also needs to be a real variable thats initial value is 1. I fixed the code up above and added another trigger.

Code:
Events:
BOUNCES == 6 (whatever number of bounces you want)

Conditions:

Actions:
For each integer A from 1 to BOUNCES do
   Explode DUMMYUNIT[Integer A]
Set BOUNCES = 1

This won't work if multiple people cast chain lightning. Sry. It might work better for multiple casts, if you just create 1 dummy unit and move him instantly to where he attacked. I dunno.
02-05-2004, 01:13 AM#12
Dalten
Quote:
You orderred it to follow the target after you orderred it to cast the spell.


Got it, thanks.

The reason I had it following was to prove it properly aquired the target. I wasn't giving it enough time to cast the spell before I killed the unit.

I got it working, thanks.

Btw this isn't my real trigger, it's just in a demo map to test it out, it'll look a lot different once I have it in my map.
02-05-2004, 01:20 AM#13
linkmaster23
Ah... that's what it was... I missed that. Good Catch.
02-05-2004, 01:36 AM#14
Dalten
Yep, it looks just like the real chain lightning, as long as I pause the units that are getting hit by it. This is actually perfectly fine though since anyone getting by huge Volts of power isn't going to continue doing the 100 meter dash anyway.

See this is spell is going to be the proc on one of my uber items in my RPG, something like a 5% chance to proc chain lightning on a target or some such. By knowing exactly what target is getting hit though I can manipulate them a lot more, for example if they have a certain debuff like fairy fire(not that i'll use fairy fire specifically), it might do extra damage or also return life to the attacker or something.
02-05-2004, 03:56 AM#15
Dalten
Here we go. You can set the number of targets using the For Integer A loops, change them all to whatever you want.

The event i'll worry about later, it'll be a proc so it'll have a chance to execute on attacks from a unit wielding a certain weapon. Right now it just executes on every attack by the far seer, in this case.

By shutting it off at the start and turning it back on when its done I dont have to worry about it executing twice at the same time, since the first thing it does is disable itself from executing again.

edit: oops, uploaded the wrong pic.