| 09-13-2006, 11:19 PM | #1 |
I am making a spell based on forked lightning. I want to (using triggers) make it so for every unit hit with it, it heals the caster. How would i do that? |
| 09-14-2006, 03:54 PM | #2 |
You will need to trigger the forked lightning, completly remake the spell, and then count the amount of units it hits and heal caster n*healamount. This wasent a very good answer, but its basically what you need to do. |
| 09-16-2006, 06:26 PM | #3 |
That might actually help me, didnt think of going into integers or reals :) Post 2: nvm, i am still stuck :( Edited by Blade.dk. Reason: Double posting is not allowed. |
| 09-16-2006, 09:24 PM | #4 |
hmmm... Maybe give your spell a buff, then create a trigger that kicks in when the unit begins the effect of an ability, specify your ability through conditions, and then do something like "Unit Group" Pick every unit matching condition, the condition being Matching unit has buff (your buff). Then inside the loop, have an integer (call it whatever) then use Set variable (your variable) to (your variable) + 1. Then, do a For each integer variable A(or B) do actions. Set the Integer A variable to your variable, then under the actions look for something having to do with healing units. This should work. Sorry i had to type all this, but I don't have WE on this computer and I suck at doing it freehand. Also, I don' think this is MUI, but to figure out how to do it, check out my tutorial "The ways of MUI in GUI" it should help you. |
| 09-16-2006, 10:29 PM | #5 |
tried it, but doesnt really work at all. remember, the ability is to heal the caster, while dealing out damage to multiple people. the base spell is forked lightning. |
| 09-17-2006, 01:47 PM | #6 |
O man, i am at school now and dont have JASSCRAFT with me now, but anyways, let me give you an outline in JASS (if u understand it) about what you may need. I'll try not to use tables and handles cause it may be too complex, but if u do understand it, then i'll go to smth more complex JASS:function ForkedLightning_Pick takes unit u, unit t, group add returns unit local group g = CreateGroup() local unit f = null local unit n = null local real x = GetUnitX(t) local real y = GetUnitY(t) local real fx local real fy local real p = 100000 // screw this, just make this as large as possible call GroupEnumUnitsInRange(g, x, y, 500., null) loop set f = FirstOfGroup(g) exitwhen f == null call GroupRemoveUnit(g, f) if IsUnitEnemy(f, GetOwningPlayer(u)) and IsUnitInGroup(f, add) == false then set fx = GetUnitX(f) - x set fy = GetUnitY(f) - y if (fx * fx + fy * fy) < p*p then // forgot the exact code of this thing, but it should find the nearest unit to the target of the fork lightning spell set p = SquareRoot(fx * fx + fy * fy) set f = n endif endif endloop call DestroyGroup(g) set f = null set g = null return n endfunction function ForkedLightning_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local unit t = GetSpellTargetUnit() local integer a = 1 local unit p = null local group gp = CreateGroup() local unit d local integer l = GetUnitAbilityLevel(u, 'a000') // replace 'a000' with whatever ability raw code that is your forked lightning local group add = CreateGroup() // just in case ur countunitsingroup function destroys the group loop exitwhen a == 4 // number of targets set p = ForkedLightning_Pick(u, t, add) call GroupAddUnit(add, p) set a = a + 1 endloop call GroupAddGroup(add, gp) if CountUnitsInGroup(add) != 0 then call DestroyGroup(add) set d = CreateUnit(GetOwningPlayer(u), 'u000', GetUnitX(u), GetUnitY(u), 0) // the 'u000' is whatever your raw code for the dummy is call UnitAddAbility(d, 'a001') //whatever the ability id for the dummy finger of death is -- the 'a001' thing call SetUnitAbilityLevel(d, 'a001', l) loop set p = FirstOfGroup(gp) exitwhen p == null call GroupRemoveUnit(gp, p) call IssueTargetOrder(d, "fingerofdeath", p) call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + 150.) // the amount you wan to add per unit endloop call SetUnitExploded(d, true) call KillUnit(d) endif call DestroyGroup(gp) set u = null set t = null set gp = null set p = null endfunction This should do the job, have a dummy unit and a finger of death dummy ability with lightning of forked lightning, base the ability off any single targeting spell, channel is best. If you need GUI then i cant help you further, else if u wish to know more, post here and i'll give u more help. Good luck! :) |
