| 09-20-2007, 11:23 PM | #1 |
Armageddon Channeling - Continously calls down multiple Inferno's around target point over time. Basically I just base it of a dummy Rain of Fire, and peridocailly create a dummy to cast a dummy Inferno. Due to the fact I wanted to make it MUI I thought its about time I learnt structs. Just need a thumbs up/down, whether im doing it right, or perhaps if I could make it more efficient. thx JASS:globals armdata array ArmArray integer ArmTotal=0 endglobals struct armdata unit u=null real x=0 real y=0 boolean end=false endstruct function Armageddon_Timer takes nothing returns nothing local armdata dat local integer i=0 local integer lvl=0 local real a1=0 local real a2=0 local real x=0 local real y=0 loop exitwhen i==ArmTotal set dat=ArmArray[i] if dat.end then set ArmTotal=ArmTotal-1 set ArmArray[i]=ArmArray[ArmTotal] call dat.destroy() set i=i-1 else set a1=GetRandomReal(0,360) set a2=GetRandomReal(100,350) set x=dat.x+a2*Cos(a1*.017453) set y=dat.y+a2*Sin(a1*.017453) set lvl=GetUnitAbilityLevel(dat.u,'A01G') call DummyPoint(GetOwningPlayer(dat.u),'ANin',lvl,852232,x,y,x,y) if GetUnitCurrentOrder(dat.u)!=852238 then set dat.end=true endif endif set i=i+1 endloop if ArmTotal==0 then call ClearTrigger(GetTriggeringTrigger(),null,null) endif endfunction function Armageddon_Cast takes nothing returns nothing local armdata dat=armdata.create() set dat.u=GetTriggerUnit() set dat.x=GetUnitX(dat.u) set dat.y=GetUnitY(dat.u) if ArmTotal==0 then call StartTimer(CreateTrigger(),.5,true,function Armageddon_Timer) endif set ArmTotal=ArmTotal+1 set ArmArray[ArmTotal-1]=dat endfunction function Armageddon_Events takes nothing returns nothing if GetSpellAbilityId()=='A01G' then call Armageddon_Cast() elseif GetUnitTypeId(GetEnteringUnit())=='ninf' then call ResumeAttacks(GetEnteringUnit(),0) endif endfunction //=========================================================================== function InitTrig_Armageddon takes nothing returns nothing set gg_trg_Armageddon=CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gg_trg_Armageddon,EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerRegisterEnterRectSimple(gg_trg_Armageddon,GetPlayableMapRect()) call TriggerAddAction(gg_trg_Armageddon,function Armageddon_Events) endfunction |
| 09-20-2007, 11:34 PM | #2 |
well I cant help ya with the structs ect because im on a mac and I cant use structs... ne ways I did see one thing: the "GetEnteringUnit" should be "GetTriggeringUnit" and also where is the ResumeAttacks function? |
| 09-21-2007, 02:37 AM | #3 |
It is not necessary to use GetTriggerUnit over GetEnteringUnit . JASS:set x=dat.x+a2*Cos(a1*.017453) set y=dat.y+a2*Sin(a1*.017453) Some other people would complaint about the usage of Sin and Cos, I don't really think those are inherently bad, yet in your case since you are doing random things, you can change the code in a quite awesome way... JASS:
set ax=GetRandomReal(100,350)
set ay=SquareRoot( 350*350 - ax*ax )
set x=dat.x+ax
set y=dat.y+ay
|
| 09-21-2007, 03:51 AM | #4 |
I know it is not required just it is better |
| 09-21-2007, 08:37 AM | #5 |
Sorry, I didnt want to clog the sample up to many other functions. ResumeAttacks - It just automatically orders a unit to attack move to the enemies base. Used when summoned units are spawned, or units get stunned, paused etc. DummyPoint - Just a simple create dummy unit, give ability, set level, order cast at point. Ill try the other random way then Vex, thx. |
