| 09-07-2006, 08:51 PM | #1 |
I would like to create a spell based on life drain or mana siphon than can be targeted to the players own units... i mean the unit who have the spell can cast it on a friend unit and "steal" life from it. Is that possible? i tryed to edit the "allowed targets" section in the spell but it wont work any ideas? thx |
| 09-07-2006, 09:08 PM | #2 |
Has nothing to do with triggers to be fair. It is indeed the "Allowed Targets" section in the OE that controls this. Try "Allied, Neutral, Organic" or some such. |
| 09-07-2006, 09:37 PM | #3 |
If editing the spell's allowed targets doesn't work, you need to modify gameplay constants, drain spells have a special flag there about being allowed to target friendly units. However, when targeting friendly units, they transfer mana to them instead of from them. |
| 09-08-2006, 11:49 AM | #4 |
In general, the drain abilities are known to totally screw up when you try to make them target allies. The gameplay constants might have fixed that now, but I think Anitarf will be correct in that the effects will be reversed. |
| 09-08-2006, 12:26 PM | #5 |
If it works screwy with gameplay constants, trigger it, using channel and a loop conditionaly on: JASS:function FakeDrainIsPro takes nothing returns nothing local unit c = GetTriggerUnit() local unit t = GetSpellTargetUnit() local integer oId = GetUnitCurrentOrder(c) loop exitwhen GetUnitCurrentOrder(CAST) != oId //Drain some life or do some fancy actions call TriggerSleepAction(1) endloop set c = null set t = null endfunction |
| 09-08-2006, 12:30 PM | #6 |
He might be wanting it for the lightning effect (which can not be simulated perfectly via triggers). |
| 09-08-2006, 01:11 PM | #7 |
Yeah thats true, but you can do a passable recreation of it, so long as you don't just make the lightning go from position to position, since real lightning actually attaches just short of their center, so it looks better....but meh. |
| 09-08-2006, 01:36 PM | #8 |
You also can't get the Z-height of a flying unit, so it can't be done with those. |
| 09-08-2006, 01:42 PM | #9 |
You can move the lightning every 0.05 seconds to the unit position, and fade it as well. For flying units, you can get their flying height, so you can get their Z position as well: JASS:function GetUnitZ takes unit u returns real local location l = GetUnitLoc(u) local real z = GetLocationZ(l)+GetUnitFlyHeight(u) call RemoveLocation(l) set l = null return z endfunction |
| 09-08-2006, 01:53 PM | #10 |
It wouldn't work too well becaue you wouldn't know how to get the target's missile impact z nor the caster's throw z. You can work around but sometimes it would not be too nice. I think offsetting the height by 60 works for most of the models |
| 09-08-2006, 02:17 PM | #11 | |
Quote:
You can not get a flying unit's Z-height. Period. |
| 09-08-2006, 02:34 PM | #12 |
GetLocationZ() ? . But lightning effects are affected by ground Z as well as flying heights so it isn't much of a problem? |
| 09-08-2006, 02:52 PM | #13 |
Unit's flying height is not always the same as its Z-height above its current terrain location. Try it out. |
| 09-08-2006, 03:27 PM | #14 | |
Quote:
|
| 09-08-2006, 03:29 PM | #15 |
Post your Chain Lightning spell with your way of taking flying units into account and I'll show you how to make it fail. Because it's not always the same. Did you try, say, any terrain variation? Slopes, holes, etc? Either you're lying and you didn't test, or you tested very badly. |
