| 09-07-2007, 06:11 AM | #1 | ||||
This spell was made for a contest at TheHelper.net; I don't think it fit the theme at all. I wonder if it would be better with multiple links in the chain instead of just 1 link; what do you guys think? The Spell:
Because I use Mac OS X, my code tends to get fucked up when looked at in the World Editor. To rectify this, simply use the code in the attached text file instead of that in the map trigger or use the below code. (Note: vBulletin has been known to screw with JASS tags, so please quote this post and get the correct code from there) Full Code://*****************************************************************************************\\ // Spell Name: Chains of Solidarity \\ // Spell Author: Pyrogasm \\ // \\ // Follows the JESP Standard \\ //*****************************************************************************************\\ constant function ChainsOfSolidarity_AbilityId takes nothing returns integer return 'A000' //Rawcode of the spell itself. endfunction constant function ChainsOfSolidarity_DummyUnitId takes nothing returns integer return 'h000' //This unit MUST have a "cast backswing point" of 0.00 endfunction //And CANNOT have negative regeneration. constant function ChainsOfSolidarity_DummyLightningSpellId takes nothing returns integer return 'A001' //The "CoS Dummy Lightning spell" determines the lightning effect. endfunction constant function ChainsOfSolidarity_DummyLightningSpellOrderString takes nothing returns string return "fingerofdeath" //The orderstring of the dummy lightning spell if you didn't use mine. endfunction constant function ChainsOfSolidarity_DummyBuffSpellId takes nothing returns integer return 'A002' //The "CoS Dummy Buff Spell" spell. endfunction constant function ChainsOfSolidarity_DummyBuffSpellOrderString takes nothing returns string return "unholyfrenzy" //The orderstring of the dummy buff spell if you didn't use mine. endfunction constant function ChainsOfSolidarity_BuffId takes nothing returns integer return 'B000' //The "Chains of Solidarity (Buff)" buff endfunction constant function ChainsOfSolidarity_CrowFormAbilityId takes nothing returns integer return 'Amrf' //Medivh's Crow form ability; you don't need to change this rawcode unless endfunction //you modified it in your map. If you have, copy it, reset the copied one, //and use its rawcode here. constant function ChainsOfSolidarity_BreakDistance takes integer Level returns real return 1500.00 //If the two units are farther than this distance apart, the spell will end. endfunction constant function ChainsOfSolidarity_DummyFlyHeight takes integer Level returns real return 22.00 //If you want the lightning effect on the caster to be higher or lower. endfunction //It will always go directly to the target. constant function ChainsOfSolidarity_Duration takes integer Level returns real return 10.00 + (1.00*Level) //Duration of the lightning effect is changed in the Object Editor. endfunction constant function ChainsOfSolidarity_HealthPerSecond takes integer Level returns real return 20.00 + (15.00*Level) //In Health per Second. endfunction constant function ChainsOfSolidarity_LineWidth takes integer Level returns real return 145.00 //Distance from center to outer edge of line. endfunction constant function ChainsOfSolidarity_CircleOptions takes integer Level returns integer return 3 //0 = no circles; 1 = only around target; 2 = only around caster; 3 = around both endfunction constant function ChainsOfSolidarity_CircleRadius takes integer Level, integer WhichCircle returns real if WhichCircle == 1 then //Radius of the circle(s) around the caster/target return 75.00 //This might conceivably be the same as the LineWidth. elseif WhichCircle == 2 then //To make it only affect the caster/target, simply put 10.00 return 75.00 //Or something. endif return 0.00 //Just a safety return; don't change this endfunction constant function ChainsOfSolidarity_MinHeight takes integer Level returns real return 0.00 //No units below this height will be affected endfunction constant function ChainsOfSolidarity_MaxHeight takes integer Level returns real return 500.00 //No units above this height will be affected endfunction constant function ChainsOfSolidarity_TimerInterval takes integer Level returns real return 0.04 //Interval that the timer runs at; this affects the lightning effect endfunction constant function ChainsOfSolidarity_HealAllies takes integer Level returns boolean return true endfunction constant function ChainsOfSolidarity_HealEnemies takes integer Level returns boolean return false endfunction constant function ChainsOfSolidarity_HealOnCast takes integer Level returns boolean return false endfunction constant function ChainsOfSolidarity_HealGround takes integer Level returns boolean return true endfunction constant function ChainsOfSolidarity_HealAir takes integer Level returns boolean return true endfunction constant function ChainsOfSolidarity_EffectPath takes nothing returns string return "Abilities\\Weapons\\WingedSerpentMissile\\WingedSerpentMissile.mdl" endfunction constant function ChainsOfSolidarity_EffectAttach takes nothing returns string return "chest" endfunction constant function ChainsOfSolidarity_EffectInterval takes nothing returns real return 0.48 //This should probably be a multiple of the timer interval endfunction //*****************************************************************************************\\ // Start External Functions \\ //*****************************************************************************************\\ //============================= // Function by grim001 //============================= function ChainsOfSolidarity_GroupEnumUnitsInQuad takes group g, real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4, boolexpr f returns nothing local real maxx local real minx local real maxy local real miny local unit u local real ux local real uy local group g2 = CreateGroup() local rect r if x1 >= x2 and x1 >= x3 and x1 >= x4 then set maxx = x1 elseif x2 >= x1 and x2 >= x3 and x2 >= x4 then set maxx = x2 elseif x3 >= x1 and x3 >= x2 and x3 >= x4 then set maxx = x3 else set maxx = x4 endif if x1 <= x2 and x1 <= x3 and x1 <= x4 then set minx = x1 elseif x2 <= x1 and x2 <= x3 and x2 <= x4 then set minx = x2 elseif x3 <= x1 and x3 <= x2 and x3 <= x4 then set minx = x3 else set minx = x4 endif if y1 >= y2 and y1 >= y3 and y1 >= y4 then set maxy = y1 elseif y2 >= y1 and y2 >= y3 and y2 >= y4 then set maxy = y2 elseif y3 >= y1 and y3 >= y2 and y3 >= y4 then set maxy = y3 else set maxy = y4 endif if y1 <= y2 and y1 <= y3 and y1 <= y4 then set miny = y1 elseif y2 <= y1 and y2 <= y3 and y2 <= y4 then set miny = y2 elseif y3 <= y1 and y3 <= y2 and y3 <= y4 then set miny = y3 else set miny = y4 endif set r = Rect(minx, miny, maxx, maxy) call GroupEnumUnitsInRect(g2, r, f) loop set u = FirstOfGroup(g2) exitwhen u == null call GroupRemoveUnit(g2, u) set ux = GetUnitX(u) set uy = GetUnitY(u) if (uy - y1)*(x2 - x1) - (ux - x1)*(y2 - y1) <= 0. then if (uy - y2)*(x3 - x2) - (ux - x2)*(y3 - y2) <= 0. then if (uy - y3)*(x4 - x3) - (ux - x3)*(y4 - y3) <= 0. then if (uy - y4)*(x1 - x4) - (ux - x4)*(y1 - y4) <= 0. then call GroupAddUnit(g, u) endif endif endif endif endloop call DestroyGroup(g2) call RemoveRect(r) set g2 = null set r = null endfunction //*****************************************************************************************\\ // End External Functions \\ //*****************************************************************************************\\ function ChainsOfSolidarity_CastConditions takes nothing returns boolean return GetSpellAbilityId() == ChainsOfSolidarity_AbilityId() endfunction function ChainsOfSolidarity_HealFilter takes nothing returns boolean local unit U = GetFilterUnit() local boolean Ally = bj_slotControlUsed[95] and IsUnitAlly(U, bj_forceRandomCurrentPick) local boolean Enemy = bj_slotControlUsed[96] and IsUnitEnemy(U, bj_forceRandomCurrentPick) local boolean Ground = bj_slotControlUsed[97] and (IsUnitType(U, UNIT_TYPE_FLYING) == true) local boolean Air = bj_slotControlUsed[98] and (IsUnitType(U, UNIT_TYPE_GROUND) == true) set U = null return (Ally or Enemy) and (Ground or Air) endfunction function ChainsOfSolidarity_Heal takes unit U, integer Level, boolean Effects, real X, real Y, real X2, real Y2, real TimerInterval returns nothing local real Width = ChainsOfSolidarity_LineWidth(Level) local real HealAmount = ChainsOfSolidarity_HealthPerSecond(Level)*TimerInterval local real Angle = Atan2((Y2-Y),(X2-X)) local integer CircleOptions = ChainsOfSolidarity_CircleOptions(Level) local string EffectPath local string EffectAttach local unit U3 local group G = CreateGroup() local group G2 local real Side1X = X2 - X local real Side1Y = Y2 - Y local real Side2X = Width*Cos(Angle-1.5708) local real Side2Y = Width*Sin(Angle-1.5708) local real RX4 = X + Side2X*0.5 local real RY4 = Y + Side2Y*0.5 local real RX3 = RX4 + Side1X local real RY3 = RY4 + Side1Y local real RX2 = RX3 - Side2X local real RY2 = RY3 - Side2Y local real RX1 = RX2 - Side1X local real RY1 = RY2 - Side1Y if Effects then set EffectPath = ChainsOfSolidarity_EffectPath() set EffectAttach = ChainsOfSolidarity_EffectAttach() endif set bj_slotControlUsed[95] = ChainsOfSolidarity_HealAllies(Level) set bj_slotControlUsed[96] = ChainsOfSolidarity_HealEnemies(Level) set bj_slotControlUsed[97] = ChainsOfSolidarity_HealGround(Level) set bj_slotControlUsed[98] = ChainsOfSolidarity_HealAir(Level) set bj_forceRandomCurrentPick = GetOwningPlayer(U) call ChainsOfSolidarity_GroupEnumUnitsInQuad(G, RX1, RY1, RX2, RY2, RX3, RY3, RX4, RY4, Condition(function ChainsOfSolidarity_HealFilter)) if CircleOptions > 0 then set G2 = CreateGroup() set bj_groupAddGroupDest = G if CircleOptions == 1 or CircleOptions == 3 then call GroupEnumUnitsInRange(G2, X2, Y2, ChainsOfSolidarity_CircleRadius(Level, 1), Condition(function ChainsOfSolidarity_HealFilter)) call ForGroup(G2, function GroupAddGroupEnum) call GroupClear(G2) endif if CircleOptions == 2 or CircleOptions == 3 then call GroupEnumUnitsInRange(G2, X, Y, ChainsOfSolidarity_CircleRadius(Level, 2), Condition(function ChainsOfSolidarity_HealFilter)) call ForGroup(G2, function GroupAddGroupEnum) endif call DestroyGroup(G2) set G2 = null endif loop set U3 = FirstOfGroup(G) exitwhen U3 == null call SetWidgetLife(U3, GetWidgetLife(U3)+HealAmount) if Effects then call DestroyEffect(AddSpecialEffectTarget(EffectPath, U3, EffectAttach)) endif call GroupRemoveUnit(G, U3) endloop call DestroyGroup(G) set G = null endfunction function ChainsOfSolidarity_Callback takes nothing returns nothing local timer T = GetExpiredTimer() local integer ArrayIndex = GetCSData(T) local unit U = GetArrayUnit(ArrayIndex, 1) local unit U2 = GetArrayUnit(ArrayIndex, 2) local integer Level = GetArrayInt(ArrayIndex, 4) local real X = GetUnitX(U) local real Y = GetUnitY(U) local real X2 = GetUnitX(U2) local real Y2 = GetUnitY(U2) local unit Dummy = GetArrayUnit(ArrayIndex, 3) local real Duration = ChainsOfSolidarity_Duration(Level) local real TimerInterval = ChainsOfSolidarity_TimerInterval(Level) local real BreakDist = ChainsOfSolidarity_BreakDistance(Level) local real Elapsed = GetArrayReal(ArrayIndex, 5) if Elapsed > Duration or GetWidgetLife(U) < 0.406 or GetWidgetLife(U2) < 0.406 or (X-X2)*(X-X2)+(Y-Y2)*(Y-Y2) > BreakDist*BreakDist then set Level = ChainsOfSolidarity_BuffId() call RemoveUnit(Dummy) call UnitRemoveAbility(U, Level) call UnitRemoveAbility(U2, Level) call PauseTimer(T) call DestroyArray(ArrayIndex) call DestroyTimer(T) else call SetArrayReal(ArrayIndex, 5, Elapsed+TimerInterval) call SetUnitX(Dummy, X) call SetUnitY(Dummy, Y) call ChainsOfSolidarity_Heal(U, Level, (ModuloReal(Elapsed, ChainsOfSolidarity_EffectInterval()) <= TimerInterval), X, Y, X2, Y2, TimerInterval) endif set U = null set U2 = null set Dummy = null set T = null endfunction function ChainsOfSolidarity_Cast takes nothing returns nothing local unit U = GetTriggerUnit() local unit U2 = GetSpellTargetUnit() local integer Level = GetUnitAbilityLevel(U, ChainsOfSolidarity_AbilityId()) local real X = GetUnitX(U) local real Y = GetUnitY(U) local integer DummySpellId = ChainsOfSolidarity_DummyLightningSpellId() local unit Dummy local real Duration = ChainsOfSolidarity_Duration(Level) local real TimerInterval = ChainsOfSolidarity_TimerInterval(Level) local timer T = CreateTimer() local integer ArrayIndex = NewArray(6, true) local string OrderString = ChainsOfSolidarity_DummyBuffSpellOrderString() set bj_forceRandomCurrentPick = GetOwningPlayer(U) set Dummy = CreateUnit(bj_forceRandomCurrentPick, ChainsOfSolidarity_DummyUnitId(), X, Y, 0.00) call UnitAddAbility(Dummy, DummySpellId) call SetUnitAbilityLevel(Dummy, DummySpellId, Level) call IssueTargetOrder(Dummy, ChainsOfSolidarity_DummyLightningSpellOrderString(), U2) call UnitApplyTimedLife(Dummy, 'BTLF', Duration+TimerInterval) call SetArrayObject(ArrayIndex, 1, U) call SetArrayObject(ArrayIndex, 2, U2) call SetArrayObject(ArrayIndex, 3, Dummy) call SetArrayInt(ArrayIndex, 4, Level) call SetCSData(T, ArrayIndex) set DummySpellId = ChainsOfSolidarity_CrowFormAbilityId() call UnitAddAbility(Dummy, DummySpellId) call UnitRemoveAbility(Dummy, DummySpellId) call SetUnitFlyHeight(Dummy, ChainsOfSolidarity_DummyFlyHeight(Level), 10000.00) set DummySpellId = ChainsOfSolidarity_DummyBuffSpellId() set Dummy = CreateUnit(bj_forceRandomCurrentPick, ChainsOfSolidarity_DummyUnitId(), X, Y, 0.00) call UnitAddAbility(Dummy, DummySpellId) call SetUnitAbilityLevel(Dummy, DummySpellId, Level) call IssueTargetOrder(Dummy, OrderString, U) call IssueTargetOrder(Dummy, OrderString, U2) call UnitApplyTimedLife(Dummy, 'BTLF', 1.00) if ChainsOfSolidarity_HealOnCast(Level) then call ChainsOfSolidarity_Heal(U, Level, true, X, Y, GetUnitX(U), GetUnitY(U), TimerInterval) endif call TimerStart(T, TimerInterval, true, function ChainsOfSolidarity_Callback) set U = null set U2 = null set Dummy = null set T = null endfunction //=========================================================================== function InitTrig_ChainsOfSolidarity takes nothing returns nothing set gg_trg_ChainsOfSolidarity = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_ChainsOfSolidarity, EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddCondition(gg_trg_ChainsOfSolidarity, Condition(function ChainsOfSolidarity_CastConditions)) call TriggerAddAction(gg_trg_ChainsOfSolidarity, function ChainsOfSolidarity_Cast) call Preload(ChainsOfSolidarity_EffectPath()) endfunction And if, by some miracle, you can't figure out how to implement it, an additional copy of the instructions can be found below.
Spell download is below. |
| 09-07-2007, 10:56 AM | #2 |
Why didn't you add the picture to the post?? I'll check it out this night. |
| 09-07-2007, 01:45 PM | #3 |
It's a strange spell.I mean the way it heal is unusual. |
| 09-07-2007, 07:25 PM | #4 |
I think its neat, though I agree, Holy it may be not, cool, however, it is |
| 09-07-2007, 07:26 PM | #5 |
It is a little weird I guess, but I think that is what makes it interesting. |
| 09-08-2007, 02:01 AM | #6 |
Oh, sorry. I'll attach the picture to the post. Would it be better with a chain function? |
| 09-08-2007, 10:12 AM | #7 |
I didn't have the time to download the map, but since you so conveniently posted the code I read through it here.
|
| 09-08-2007, 09:07 PM | #8 | ||||||
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
| 09-09-2007, 07:18 PM | #9 |
If one unit was at one corner of the map and the other on the opposite corner, it would be very hectic. Maybe you should have so if the units get too far apart the link will break. |
| 09-09-2007, 08:25 PM | #10 | |
Quote:
Ejem.... JASS:constant function CoS_BreakDistance takes integer Level returns real return 1500.00 //If the two units are farther than this distance apart, the spell endfunction //Will end. |
| 09-09-2007, 08:53 PM | #11 |
Yep; that's what that's there for. |
| 09-11-2007, 09:02 AM | #12 | |||
Quote:
Quote:
Quote:
|
| 09-11-2007, 12:41 PM | #13 | |
Quote:
I mean, I see the -- Code:
The spell has a configuration header. |
| 09-11-2007, 07:51 PM | #14 |
Hmm, I suppose I wrote that a bit ambiguously. The comment about the spell documentation needing to be in the same GUI trigger was not meant to imply that the JESP standard states so, but rather that I feel it should be so. I think it is in the spirit of the JESP standard though. |
| 09-12-2007, 12:07 AM | #15 |
I can do it, I suppose... I'll update this spell with all of the suggested fixes fixed in maybe 5 hours or so after I return home. |
