Nherwyziant
Be better than you were yesterday :D
- Reaction score
- 96
Hi, I have created a spell that creates blocks around him. But this spell is not yet finished, I discontinued finishing it since I have noticed it's not MUI xD.
Can someone help me convert it to MUI and let me study it? The part with the damage is not yet added, cuz as what I said, not yet finished. I just need to convert it to MUI and let me be the one to add the damage part
Requires TimerUtils
Demo maps will be here
Can someone help me convert it to MUI and let me study it? The part with the damage is not yet added, cuz as what I said, not yet finished. I just need to convert it to MUI and let me be the one to add the damage part
Requires TimerUtils
JASS:
scope SpiritShield
globals
private constant integer RAWCODE = 039;A001039; //The rawcode of spell
private constant integer DUMMY = 039;h001039; //Rawcode of the dummy
private constant integer NUMBER = 5 //The number of spawning dummy per side
private constant real INCREMENT = 250. //Speed of every stuff
private constant real DISTANCE = 250. //Distance away from the caster
private constant real AWAY = 10. //Distance between the stuffs
endglobals
globals
private real MAX_X
private real MAX_Y
private real MIN_X
private real MIN_Y
endglobals
private function Outside takes real x,real y returns boolean
if x < MAX_X and y < MAX_Y and x > MIN_X and y > MIN_Y then
return false
else
return true
endif
endfunction
private struct Struct
private static group MOVER = CreateGroup()//I know
private static unit CASTER = null//This part is the one
private static timer TIMER = null//That makes
private static real r = -180//This spell
private static integer i = 0// Un-MUI
private static method M5 takes nothing returns nothing
set .i = .i + 1
endmethod
private static method M4 takes nothing returns nothing
call KillUnit(GetEnumUnit())
endmethod
private static method M3 takes nothing returns nothing
local unit u = GetEnumUnit()
local real x
local real y
if GetUnitState(u,UNIT_STATE_LIFE) != 1 then
set x = GetUnitX(CASTER)+DISTANCE*Cos(((GetUnitFacing(CASTER)+.r)-(AWAY*GetUnitUserData(u)))*bj_DEGTORAD)
set y = GetUnitY(CASTER)+DISTANCE*Sin(((GetUnitFacing(CASTER)+.r)-(AWAY*GetUnitUserData(u)))*bj_DEGTORAD)
else
set x = GetUnitX(CASTER)+DISTANCE*Cos(((GetUnitFacing(CASTER)-.r)+(AWAY*GetUnitUserData(u)))*bj_DEGTORAD)
set y = GetUnitY(CASTER)+DISTANCE*Sin(((GetUnitFacing(CASTER)-.r)+(AWAY*GetUnitUserData(u)))*bj_DEGTORAD)
endif
if not Outside(x,y) then
call SetUnitX(u,x)
call SetUnitY(u,y)
call SetUnitFacing(u,bj_RADTODEG*Atan2(y-GetUnitY(CASTER),x-GetUnitX(CASTER))-180)
else
call GroupRemoveUnit(MOVER,u)
call KillUnit(u)
endif
set u = null
endmethod
private static method M2 takes nothing returns nothing
local Struct this = GetTimerData(GetExpiredTimer())
set .r = .r + (INCREMENT/32)
call ForGroup(MOVER,function Struct.M3)
set .i = 0
call ForGroup(MOVER,function Struct.M5)
if .i == 0 then
call IssueImmediateOrder(CASTER,"unimmolation")
endif
endmethod
private static method M1 takes nothing returns boolean
local Struct this = Struct.allocate()
local unit u = null
local integer i = 0
if GetIssuedOrderId() == OrderId("immolation") then
set CASTER = GetTriggerUnit()
set TIMER = NewTimer()
loop
set i = i + 1
set u = CreateUnit(GetOwningPlayer(CASTER),DUMMY,GetUnitX(CASTER),GetUnitY(CASTER),GetUnitFacing(CASTER))
call GroupAddUnit(MOVER,u)
call SetUnitUserData(u,i-1)
set u = null
set u = CreateUnit(GetOwningPlayer(CASTER),DUMMY,GetUnitX(CASTER),GetUnitY(CASTER),GetUnitFacing(CASTER))
call GroupAddUnit(MOVER,u)
call SetUnitUserData(u,i-1)
call SetUnitState(u,UNIT_STATE_LIFE,1)
exitwhen i == NUMBER
endloop
call SetTimerData(TIMER,this)
call TimerStart(TIMER,.03125,true,function Struct.M2)
else
if GetIssuedOrderId() == OrderId("unimmolation") then
call ReleaseTimer(TIMER)
set .r = -180
set .i = 0
call ForGroup(MOVER,function Struct.M4)
endif
endif
set u = null
return false
endmethod
private static method onInit takes nothing returns nothing
local trigger g = CreateTrigger()
local integer i = 0
loop
call TriggerRegisterPlayerUnitEvent(g,Player(i),EVENT_PLAYER_UNIT_ISSUED_ORDER,null)
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(g,Condition(function Struct.M1))
set g = null
set MOVER = CreateGroup()
set MAX_X = GetRectMaxX(bj_mapInitialPlayableArea) - 64
set MAX_Y = GetRectMaxY(bj_mapInitialPlayableArea) - 64
set MIN_X = GetRectMinX(bj_mapInitialPlayableArea) + 64
set MIN_Y = GetRectMinY(bj_mapInitialPlayableArea) + 64
endmethod
endstruct
endscope
Demo maps will be here