|
|
#136 |
|
Lackadaisically Absent.
Respected User
|
Well, not that anyone looks at these things anyway, but... code WIP! Lolololol1l1olo!111!O!noneoe
__________________ JASS://Requires IsUnitSpellResistant, Table, TimerUtils, SimError scope GoblinSwitcherooDevice initializer Init globals private constant integer SPELL_ID = 'Gswd' private constant integer STUN_ID = 'Sgsd' private constant integer DUMMY_ID = 'dgsd' private constant integer LIGHTNING_ID = 'Lgsd' private constant integer BUFF_ID = 'Bgsd' private constant real TIMER_INTERVAL = 0.025 private constant integer TARGET_NUMBER = 2 private constant string SPELL_ORDER = "innerfire" private constant string CANCEL_ORDER = "slow" private constant real CANCEL_UPDATE_PERIOD = 0.10 private constant real START_SPEED = 100.00 private constant real ACCELERATION = 4.00 endglobals private function TargetFilter takes unit FilterUnit, unit Caster, player CasterOwner, integer Level returns boolean return IsUnitSpellImmune(FilterUnit) and GetPlayerNumber(GetOwningPlayer(FilterUnit)) < 12 endfunction globals public trigger SpellTrig = null public trigger OrderTrig = null private SpellData array Datas private HandleTable TableDatas = 0 private integer N = 0 private timer T = null private integer CancelOrderId = 0 private integer SpellOrderId = 0 private player LocalP = null endglobals private function CastConditions takes nothing returns boolean return GetSpellAbilityId() == SPELL_ID endfunction private struct SpellData boolean Active = true timer T = null integer Level = 0 integer Count = 0 unit Caster = null player P = null real CX = 0.00 real CY = 0.00 unit array T[TARGET_NUMBER] unit array D[TARGET_NUMBER] real array TX[TARGET_NUMBER] real array TY[TARGET_NUMBER] real array TCX[TARGET_NUMBER] real array TCY[TARGET_NUMBER] real array TA[TARGET_NUMBER] real array TH[TARGET_NUMBER] method Refresh takes nothing returns nothing set .Active = true call ReleaseTimer(.T) endmethod method Stop takes nothing returns nothing endmethod method AddTarget takes unit NewTarget returns nothing if TargetFilter(NewTarget, .Caster, .P, .Level) then set .T[.Count] = NewTarget set .D[.Count] = CreateUnit(.P, DUMMY_ID, GetUnitX(.Caster), GetUnitY(.Caster), 0.00) call UnitAddAbility(.D[.Count], LIGHTNING_ID) call IssueTargetOrder(.D[.Count], "fingerofdeath", .T[.Count]) set .Count = .Count+1 else call SimError(.P, "Invalid Target.") endif endmethod method SetupNextTarget takes nothing returns nothing call DisableTrigger(OrderTrig) call PauseUnit(.Caster, true) call IssueImmediateOrder(.Caster, "stop") call PauseUnit(.Caster, false) call EnableTrigger(OrderTrig) if LocalP == .P then call ForceUIKey(SPELL_HOTKEY) endif set .Active = false set .T = NewTimer() call TimerStart(.T, CANCEL_UPDATE_PERIOD, false, function SpellData.Refresh) endmethod static method create takes unit Caster returns SpellData local SpellData SD = SpellData.allocate() set SD.Level = GetUnitAbilityLevel(Caster, SPELL_ID) set SD.Caster = Caster set SD.P = GetOwningPlayer(Caster) return SD endmethod method onDestroy takes nothing returns nothing local integer J = 0 loop call UnitRemoveAbility(.T[J], BUFF_ID) call RemoveUnit(.D[J]) set .T[J] = null set .D[J] = null set J = J+1 exitwhen J > TARGET_NUMBER-1 endloop set .Caster = null endmethod endstruct private function Periodic takes nothing returns nothing //Blah endfunction private function Cast takes nothing returns nothing local SpellData SD = TableDatas[GetTriggerUnit()] local real CastX = GetUnitX(SD.Caster) local real CastY = GetUnitY(SD.Caster) call UnitAddAbility(SD.D1, STUN_ID) call UnitAddAbility(SD.D1, LIGHTNING_ID) call UnitAddAbility(SD.D2, LIGHTNING_ID) call IssueTargetOrder(SD.D1, "thunderbolt", SD.T1) call IssueTargetOrder(SD.D1, "thunderbolt", SD.T2) call IssueTargetOrder(SD.D1, "fingerofdeath", SD.T1) call IssueTargetOrder(SD.D2, "fingerofdeath", SD.T2) set Datas[N] = SD set N = N+1 if N == 1 then call TimerStart(T, TIMER_INTERVAL, true, function Periodic) endif endfunction private function Order takes nothing returns boolean local integer O = GetIssuedOrderId() local unit C local SpellData SD if O == CancelOrderId then call TableDatas[GetTriggerUnit()].Stop() elseif O == SpellOrderId then set C = GetTriggerUnit() set SD = TableDatas[GetTriggerUnit()] if SD == 0 and GetUnitAbilityLevel(C, SPELL_ID) > 0 then set SD = SD.create(C) set TableDatas[C] = SD endif call SD.AddTarget(GetOrderTargetUnit()) if SD.Count < TARGET_NUMBER then call SD.SetupNextTarget() endif endif return false endfunction private function Init takes nothing returns nothing set SpellTrig = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(SpellTrig, EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddCondition(SpellTrig, Condition(function CastConditions)) call TriggerAddAction(SpellTrig, function Cast) set OrderTrig = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(SpellTrig, EVENT_PLAYER_UNIT_ISSUED_ORDER) call TriggerAddCondition(SpellTrig, Condition(function Order)) set T = CreateTimer() set TableDatas = HandleTable.create() set CancelOrderId = OrderId(CANCEL_ORDER) set SpellOrderId = OrderId(SPELL_ORDER) set LocalP = GetLocalPlayer() endfunction endscope |
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#137 |
|
~There we go~
|
^Lawl. Something tells me I should stop fixing up my terrain and actually make the spell. xD
__________________ |
|
|
|
|
|
#138 | |
|
100% Genuine Retard!
|
Quote:
|
|
|
|
|
|
|
#139 |
|
~There we go~
|
Bah, it's GUI. It'll seriously take me, like, a few hours max.
__________________Remember, Simple, yet Functional. |
|
|
|
|
|
#140 |
|
Laughs Derisively
Project Member: PoC
|
I still get awful lag during multiple instances. Weird. Perhaps the orb attachments are a problem? I could just go with the original design: Howl of Terror overhead.
__________________And on Pyrogasm's note, MY WIP CODE: JASS:scope Vex initializer Init globals private constant integer SPELL_ID = 'A000' private constant integer BUFF_ID = 'B000' private constant integer DUMMY_ID = 'dumm' private constant integer DBUFF_ID = 'BFig' private constant real DUMMY_TIMED = 1.00 private constant real TIMER_CYCLE = 0.10 endglobals private keyword EFFECT private function ConfigureEffects takes nothing returns nothing set EFFECT[0].a = 'A001' set EFFECT[0].b = 'B001' set EFFECT[0].o = "cripple" set EFFECT[1].a = 'A002' set EFFECT[1].b = 'B002' set EFFECT[1].o = "faeriefire" set EFFECT[2].a = 'A003' set EFFECT[2].b = 'B003' set EFFECT[2].o = "shadowstrike" set EFFECT[3].a = 'A004' set EFFECT[3].b = 'B004' set EFFECT[3].o = "slow" set EFFECT[4].a = 'A005' set EFFECT[4].b = 'B005' set EFFECT[4].o = "unholyfrenzy" set EFFECT[5].a = 'A006' set EFFECT[5].b = 'B006' set EFFECT[5].o = "banish" set EFFECT[6].a = 'A007' set EFFECT[6].b = 'B007' set EFFECT[6].o = "curse" set EFFECT[7].a = 'A008' set EFFECT[7].b = 'B008' set EFFECT[7].o = "entanglingroots" set EFFECT[8].a = 'A00A' set EFFECT[8].b = 'B00A' set EFFECT[8].o = "soulburn" endfunction private function GetEffectCount takes unit caster returns integer return 1 + GetUnitAbilityLevel(caster,SPELL_ID) endfunction //=========================================================================== private struct EFFECT extends array integer a // Ability Id integer b // Buff Id string o // Order String endstruct globals private integer EFFECT_LIMIT = 0 endglobals private function SetEffectLimit takes nothing returns nothing local integer i = 0 loop exitwhen EFFECT[i].a == 0 set i = i + 1 endloop set EFFECT_LIMIT = i - 1 endfunction private function PreloadAbilities takes nothing returns nothing local integer i = 0 local unit u = CreateUnit(Player(15),DUMMY_ID,0,0,0) call ShowUnit( u, false ) loop call UnitAddAbility( u, EFFECT[i].a ) set i = i + 1 exitwhen i == EFFECT_LIMIT endloop call RemoveUnit(u) set u = null endfunction private function DispelVexEffects takes unit u returns nothing local integer i = 0 loop call UnitRemoveAbility(u,EFFECT[i].b) exitwhen i == EFFECT_LIMIT set i = i + 1 endloop endfunction private struct castdata unit c // Caster unit unit t // Target unit static method create takes unit caster, unit target returns castdata local castdata d = castdata.allocate() set d.c = caster set d.t = target return d endmethod endstruct private function callback takes nothing returns nothing local timer t = GetExpiredTimer() local castdata d = GetTimerData(t) local integer i = 0 if GetUnitAbilityLevel(d.t, BUFF_ID) == 0 or GetWidgetLife(d.t) < 0.405 or GetWidgetLife(d.c) < 0.405 then call UnitRemoveAbility(d.t,BUFF_ID) call DispelVexEffects(d.t) call d.destroy() call ReleaseTimer(t) set t = null endif endfunction private function CreateSpell takes unit dummyCaster, unit caster, unit target, integer index returns nothing call UnitAddAbility( dummyCaster, EFFECT[index].a ) call SetUnitAbilityLevel( dummyCaster, EFFECT[index].a, GetUnitAbilityLevel(caster,SPELL_ID) ) call IssueTargetOrder( dummyCaster, EFFECT[index].o, target ) endfunction private function GenerateEffects takes player castPlayer, unit caster, unit target returns nothing local integer ecount = GetEffectCount(caster) local integer limit = EFFECT_LIMIT local integer i = 0 local unit u = null local integer array effects loop set effects[i] = i exitwhen i == limit set i = i + 1 endloop set u = CreateUnit( castPlayer,DUMMY_ID,GetUnitX(caster),GetUnitY(caster),GetUnitFacing(caster)) call UnitApplyTimedLife( u, DBUFF_ID, DUMMY_TIMED ) call ShowUnit( u, false ) loop set i = GetRandomInt(0,limit) call CreateSpell(u,caster,target,effects[i]) set limit = limit - 1 set effects[i] = effects[limit] set ecount = ecount - 1 exitwhen ecount == 0 endloop set u = null endfunction private function actions takes nothing returns nothing local castdata d = castdata.create(GetTriggerUnit(),GetSpellTargetUnit()) local timer t = NewTimer() call SetTimerData(t,d) call DispelVexEffects(d.t) call GenerateEffects(GetTriggerPlayer(),d.c,d.t) call TimerStart(t,TIMER_CYCLE,true,function callback) set t = null endfunction //=========================================================================== private function conditions takes nothing returns boolean return GetSpellAbilityId() == SPELL_ID endfunction private function Init takes nothing returns nothing local trigger trig = CreateTrigger() call ConfigureEffects() call SetEffectLimit() call PreloadAbilities() call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddCondition(trig,Condition(function conditions)) call TriggerAddAction(trig,function actions) endfunction endscope |
|
|
|
|
|
#141 |
|
User
Join Date: Apr 2008
Posts: 49
|
Can we use systems like TL or TT or w/e as long as the system isn't a spell? Well, actually, is there a general rule post for these spell sessions?
|
|
|
|
|
|
#142 |
|
oO
Join Date: Jul 2008
Posts: 577
![]() ![]() ![]()
|
Oshi-.. I should come up with an idea for this
|
|
|
|
|
|
#143 |
|
User
Join Date: Apr 2008
Posts: 49
|
My WIP code. So far its fantastically random! Random wait time between the spell cast and the effect, three random effects to choose from which all do random things! Chain lightning does damage based on level, with an added variable damage that increases with level. It can bounce to enemies and allies alike, and it wont always get the closest one! It also has a random number of bounces. That's as far as I am right now. Code:
JASS:scope Randomness initializer init globals private constant integer SPELL_ID = 'A000' private constant integer CHAIN_JUMP_RADIUS = 400 //Max distance for chain to jump between units private constant integer CHAIN_BASE_DMG = 100 //Base damage of chain lightning private constant integer CHAIN_INC_DMG = 30 //Constant damage increase per level, level 1 damage = 130 private constant integer CHAIN_RDM_DMG = 10 //10 above or below per level endglobals //this spell will either chain lightning, random debuff hex/curse/bloodlust/purge/heal a small/random area, or do something I have yet to determain. //Chain lightning can bounce to allies, still debating if the others should affect allies :O private struct Data timer t unit target unit caster real x real y integer i integer time integer level static method create takes unit u, unit v, integer i, integer level returns Data local Data D = Data.allocate() set D.target = u set D.caster = v set D.t = NewTimer() set D.level = level set D.time = i return D endmethod private method onDestroy takes nothing returns nothing set .caster = null call ReleaseTimer(.t) call DestroyTimer(.t) set .target = null endmethod endstruct private struct Chain real dx real dy real dist1 real dist2 unit u unit v unit w group g group immune integer i static method create takes unit u returns Chain local Chain CL = Chain.allocate() set CL.g = CreateGroup() set CL.immune = CreateGroup() set CL.u = u return CL endmethod private method onDestroy takes nothing returns nothing set .u = null set .v = null set .w = null call DestroyGroup(.g) call DestroyGroup(.immune) set .immune = null set .g = null endmethod endstruct private function Cond takes nothing returns boolean return GetSpellAbilityId() == SPELL_ID endfunction private constant function True takes nothing returns boolean return true endfunction private function ChainLightning takes Data D returns nothing local Chain CL = Chain.create(D.target) set D.i = GetRandomInt(2,3) * D.level call UnitDamageTarget(D.caster,CL.u,CHAIN_BASE_DMG + CHAIN_INC_DMG * D.level +GetRandomInt(-CHAIN_RDM_DMG * D.level,CHAIN_RDM_DMG * D.level) ,false,false,ATTACK_TYPE_MAGIC, DAMAGE_TYPE_UNIVERSAL,null) loop call GroupEnumUnitsInRange(CL.g,GetUnitX(CL.u),GetUnitY(CL.u), 400, Condition(function True)) call GroupAddUnit(CL.immune,CL.u) set CL.dist2 = CHAIN_JUMP_RADIUS loop if IsUnitInGroup(CL.v,CL.immune) == false then set CL.v = FirstOfGroup(CL.g) exitwhen CL.v == null set CL.dx = GetUnitX(CL.v) - GetUnitX(CL.u) set CL.dy = GetUnitY(CL.v) - GetUnitY(CL.u) set CL.dist1 = SquareRoot(CL.dx*CL.dx+CL.dy*CL.dy) if CL.dist1 < CL.dist2 then set CL.w = CL.v set CL.dist2 = CL.dist1 if GetRandomInt(0,3) == 3 then exitwhen true endif endif else call GroupRemoveUnit(CL.g,CL.v) if FirstOfGroup(CL.g) == null then exitwhen true endif endif endloop call UnitDamageTarget(D.caster,CL.w,CHAIN_BASE_DMG + CHAIN_INC_DMG * D.level +GetRandomInt(-CHAIN_RDM_DMG * D.level,CHAIN_RDM_DMG * D.level) ,false,false,ATTACK_TYPE_MAGIC, DAMAGE_TYPE_UNIVERSAL,null) set CL.u = CL.w exitwhen CL.i >= D.i set CL.i = CL.i+1 //CALL TIMED LIGHTNING SYSTEM TO CREATE SOME LIGHTNING >:) endloop call CL.destroy() endfunction //* set t=NewTimer() : Get a timer (alternative to CreateTimer) //* ReleaseTimer(t) : Relese a timer (alt to DestroyTimer) //* SetTimerData(t,2) : Attach value 2 to timer //* GetTimerData(t) : Get the timer's value. //* You can assume a timer's value is 0 //* after NewTimer. private function Callback takes nothing returns nothing local Data D = GetTimerData(GetExpiredTimer()) local integer rand = GetRandomInt(0,4) if rand == 0 or rand == 3 then call ChainLightning(D) //elseif rand == 1 or rand == 4 then // call RandomAoe(D) //elseif rand == 2 then // call RandomDamage(D) endif endfunction private function Act takes nothing returns nothing local Data D = Data.create(GetTriggerUnit(),GetSpellTargetUnit(),GetRandomInt(0,6),GetUnitAbilityLevel(GetTriggerUnit(),SPELL_ID)) call SetTimerData(D.t,D) call TimerStart(D.t,D.time,false,function Callback) endfunction private function init takes nothing returns nothing local integer i = 0 local trigger t = CreateTrigger() loop call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT, null) exitwhen i >= 11 set i = i+1 endloop call TriggerAddCondition(t,Condition(function Cond)) call TriggerAddAction(t, function Act) set t=null endfunction endscope Last edited by Frozenhelfire : 01-30-2009 at 09:50 AM. |
|
|
|
|
|
#144 |
|
In Flames
Join Date: Jan 2006
Posts: 1,153
|
@Frozenhelfire
__________________ JASS:
call ReleaseTimer(.t)
call DestroyTimer(.t)when you use TimerUtilss NewTimer and ReleaseTimer, NEVER destroy those timers. And maybe you should implement group recycling.. |
|
|
|
|
|
#145 |
|
User
Join Date: Apr 2008
Posts: 49
|
Why not destroy? Also, I am not advanced enough to recycle groups, I don't think.
|
|
|
|
|
|
#146 |
|
†ChÆos†™
Join Date: Jun 2006
Posts: 495
![]() ![]() ![]()
|
If you destroy a timer, the entire sense of recycling handles (this system) goes down the drain...
__________________ |
|
|
|
|
|
#147 | |
|
Procrastination Incarnate
Development Director
|
Quote:
|
|
|
|
|
|
|
#148 |
|
User
Join Date: Apr 2008
Posts: 49
|
Oh, I thought it was just clearing a local leak xD. Thanks for the clarification.
|
|
|
|
|
|
#149 |
|
†ChÆos†™
Join Date: Jun 2006
Posts: 495
![]() ![]() ![]()
|
Alright, most likely done now.
TIME FOR WIP... Well not as many options as my last spell, but i still think it is working well enough and i'm happy with the outcoming. Last edited by Fireeye : 01-30-2009 at 08:52 PM. |
|
|
|
|
|
#150 |
|
Mr. Awesome!
|
Great. It looks like I'm stuck with the version of my spell that I put in the pastebin a while back. The only serious changes were some icons and tooltips, but due to the fact that I've lost all my files, I only have that one, and currently no way to fix it, and it looks like I won't before Sunday. Oh well.
__________________ |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |