- Joined
- Jul 31, 2012
- Messages
- 2,217
I did not understand anything OO
Or maybe cuz i'm at skl.. I'll try to see them at home..
Or maybe cuz i'm at skl.. I'll try to see them at home..
library MMS4D
globals
private constant real FPS = 0.0312500
endglobals
private struct MMS_Core extends array
real x
real y
private thistype rn
private static integer count
private static thistype r
method destroy takes nothing returns nothing
set r = rn
set r = this
endmethod
static method create takes nothing returns thistype
local thistype this
if r==0 then
set count = count + 1
set this = count
else
set this = r
set r = r.rn
endif
return this
endmethod
static method onInit takes nothing returns nothing
set count = 0
set r = 0
endmethod
endstruct
struct MMS_2D extends array
delegate MMS_Core deleg
private static integer dindex
private static thistype array data
method destroy takes nothing returns nothing
call this.deleg.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.deleg = this
return this
endmethod
method doSomething takes real x, real y returns nothing
set this.x = x
set this.y = y
endmethod
private static method onInit takes nothing returns nothing
set dindex = -1
endmethod
endstruct
struct MMS_3D extends array
delegate MMS_Core core
private static integer dindex
private static thistype array data
method destroy takes nothing returns nothing
call this.core.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.core = this
return this
endmethod
static method onInit takes nothing returns nothing
set dindex = -1
endmethod
endstruct
struct MMS_4D extends array
delegate MMS_Core core
private static integer dindex
private static thistype array data
method destroy takes nothing returns nothing
call this.core.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.core = this
return this
endmethod
static method onInit takes nothing returns nothing
set dindex = -1
endmethod
endstruct
endlibrary
Basic (All)
- KBed Unit
- Targeted Unit
- Damager
- EndFx
- AoEEndFx
- Fx
- Attach
- BounceFx
- LineFx
- Instances on unit
- BounceGroup
- LineDamageGroup
- DamageType
- AttackType
- IsUnitBeingKBed
- DisableUnit
- DestroyTrees
- IsSpeedPositive
- SpeedChanger
- HasBeenImpactDamaged
- KillWhenHit
- EndWhenHit
- FaceAngle
- KillIfOutsider
- AllowOutSiding
- EndWhenDead
- KBTarget
- AoEKB
- iKB
- KillatEnd
- D_STRUCTURE
- D_MECHANICAL
- D_MAGIC_IMMINUE
- D_ALLY
- D_ENEMEY
- D_RESISTANT
- D_FLYING
- DestroyDestructable
- BounceUnit
- BounceTarget
- EndOnObstacle
- EndOnTargetBounce
- UnitPropWindow
- ImpactDamage
- LoopDamage
- TargetDamage
- LineDamage
- AoE
- ArcAngle
- AoEDamage
- KillAtTime
- StopTime
- AiEEndDamage
- AoEEndDamage
- AoEKBPower
- BouncePower
2D
- Range
- Speed
- Acceleration
- Angle
- Time
3D
- IsZNotNull
- GroundDamage
- JumpOverCliff
- Zoffset
- ZSpeed
- ZAccel
- LastTerrainZ
- InitialTerrainZ
- UnitInitialHeight
4D
- 4DEnabled (Boolean)
- 4DLapseTime (Real)
- 4DWasHidden (Boolean)
- 4DRippOff (Boolean)
- 4DBlackHole (Boolean)
- 4DAoE_3D (Real)
- 4D_RippOffDamage (Real)
- 4D_BlackHoleDPS (Real)
- 4D_RippOffSpeed (Real)
- 4D_BlackHoleSpeed (Real)
library MMS4D
globals
private constant real FPS = 0.0312500
private constant boolean NEED_3D = true
private constant boolean NEED_4D = true
//Don't forget to implement other static if boolean :)
private integer dindex = -1
//Don't worry structs are integer. Store in this array :)
private integer array data
endglobals
private struct MMS_Core extends array
unit KBed_unit
unit target
unit damager
string endFx
string aoeEndFx
string Fx
string attach
string bounceFx
string lineFx
//Wtf this one xD ? Can't we disable kb for an already existing kbed unit ?
integer instanceOnUnit
group bounceGroup
group lineDamageGroup
damagetype damageType
attacktype attackType
//Same there
boolean isUnitKbed
boolean disable
boolean destroyTrees
boolean isSpeedPositive
boolean speedChanger
boolean hasBeenImpactDamaged
boolean killWhenHit
boolean endWhenHit
boolean faceAngle
boolean killIfOutsider
boolean allowOutSiding
boolean endWhenDead
boolean KBTarget
boolean aoeKB
boolean iKB
boolean killAtEnd
boolean D_Structure
boolean D_Mechanical
boolean D_MagicImmune
boolean D_Ally
boolean D_Enemy
boolean D_Resistant
boolean D_Flying
boolean D_Destructable
boolean bounceUnit
boolean bounceTarget
boolean endOnObstacle
boolean endOnTargetBounce
//No need to store unitpropwindow there is a solution :)
//Btw the solution is GetUnitDefaultPropWindow(unit)*bj_RADTODEG
real impactDamage
real loopDamage
real targetDamage
real lineDamage
real aoe
real arcAngle
real aoeDamage
real killAtTimer
real stopTime
real aiEndDamage
real aoeEndDamage
real aoeKBDamage
real aoeKBPower
real bouncePower
private thistype rn
private static integer count
private static thistype r
method destroy takes nothing returns nothing
set this.rn = r
set r = this
endmethod
static method create takes nothing returns thistype
local thistype this
if r==0 then
set count = count + 1
set this = count
else
set this = r
set r = r.rn
endif
return this
endmethod
static method onInit takes nothing returns nothing
set count = 0
set r = 0
endmethod
endstruct
struct MMS_2D extends array
real range
real speed
real accel
real angle
real time
delegate MMS_Core core
method destroy takes nothing returns nothing
call this.core.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.core = this
return this
endmethod
endstruct
static if NEED_3D then
//Now the code of the 3D
struct MMS_3D extends array
boolean isZNotNull
real groundDamage
boolean jumpOverCliff
real zOffset
real zSpeed
real zAccel
real lastTerrainZ
real initTerrainZ
real unitInitialHeight
delegate MMS_Core core
method destroy takes nothing returns nothing
call this.core.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.core = this
return this
endmethod
endstruct
//End of the code of the 3D
endif
static if NEED_4D then
//Now the code of the 4D
struct MMS_4D extends array
//What's the use of this one ?
boolean enabled
boolean lapseTime
boolean wasHidden
boolean rippOff
boolean blackHole
real aoe3D
real rippOffDamage
real blackHoleDamage
real rippOffSpeed
real blackHoleSpeed
delegate MMS_Core core
method destroy takes nothing returns nothing
call this.core.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.core = this
return this
endmethod
static method onInit takes nothing returns nothing
set dindex = -1
endmethod
endstruct
//End of the code of the 4D
endif
endlibrary
local MMS_2D m = MMS_2D.create()
set m.KBed_unit = ..
set m.target = ...
set m.damager = ...
...
set m.range = ...
set m.speed = ...
static if NEED_4D then
//Now the code of the 4D
struct MMS_4D extends array
//What's the use of this one ?
boolean enabled
boolean lapseTime
boolean wasHidden
boolean rippOff
boolean blackHole
real aoe3D
real rippOffDamage
real blackHoleDamage
real rippOffSpeed
real blackHoleSpeed
delegate MMS_Core core
method destroy takes nothing returns nothing
call this.core.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.core = this
return this
endmethod
method test takes nothing returns nothing
if this.KBed_unit != null then
call KillUnit(this.KBed_unit)
endif
endmethod
endstruct
//End of the code of the 4D
endif
local MMS_4D m = MMS_4D.create()
set m.KBed_unit = u
call m.test()
//DO NOT FORGET
call m.destroy()
link?IsTerrainPathable by Vex is good afaik ^^
useless codeCreate a method for the 2d and one for the 3d is there difference.
wat!?Oh we can create a member in mms_core which hold the dimension and in the loop do in function of this member.
i think it would be better if we do it like this:Create a method for the 2d and one for the 3d is there difference.
Oh we can create a member in mms_core which hold the dimension and in the loop do in function of this member.
method move_dimensionally takes nothing returns nothing
call blablabla.. 2D stuff
static if WANT_3D then
call blachblach 3D stuff
endif
endmethod
library MMS4D
globals
private constant real FPS = 0.0312500
private constant boolean NEED_3D = true
private constant boolean NEED_4D = true
//Don't forget to implement other static if boolean :)
private integer dindex = -1
//Don't worry structs are integer. Store in this array :)
private integer array data
endglobals
private struct MMS_Core extends array
unit KBed_unit
unit target
unit damager
string endFx
string aoeEndFx
string Fx
string attach
string bounceFx
string lineFx
//Wtf this one xD ? Can't we disable kb for an already existing kbed unit ?
integer instanceOnUnit
group bounceGroup
group lineDamageGroup
damagetype damageType
attacktype attackType
//Same there
boolean isUnitKbed
boolean disable
boolean destroyTrees
boolean isSpeedPositive
boolean speedChanger
boolean hasBeenImpactDamaged
boolean killWhenHit
boolean endWhenHit
boolean faceAngle
boolean killIfOutsider
boolean allowOutSiding
boolean endWhenDead
boolean KBTarget
boolean aoeKB
boolean iKB
boolean killAtEnd
boolean D_Structure
boolean D_Mechanical
boolean D_MagicImmune
boolean D_Ally
boolean D_Enemy
boolean D_Resistant
boolean D_Flying
boolean D_Destructable
boolean bounceUnit
boolean bounceTarget
boolean endOnObstacle
boolean endOnTargetBounce
//No need to store unitpropwindow there is a solution :)
//Btw the solution is GetUnitDefaultPropWindow(unit)*bj_RADTODEG
real impactDamage
real loopDamage
real targetDamage
real lineDamage
real aoe
real arcAngle
real aoeDamage
real killAtTimer
real stopTime
real aiEndDamage
real aoeEndDamage
real aoeKBDamage
real aoeKBPower
real bouncePower
integer dim
private thistype rn
private static integer count
private static thistype r
method destroy takes nothing returns nothing
set this.rn = r
set r = this
endmethod
static method create takes nothing returns thistype
local thistype this
if r==0 then
set count = count + 1
set this = count
else
set this = r
set r = r.rn
endif
return this
endmethod
static method onInit takes nothing returns nothing
set count = 0
set r = 0
endmethod
endstruct
struct MMS_2D extends array
real range
real speed
real accel
real angle
real time
delegate MMS_Core core
method destroy takes nothing returns nothing
call this.core.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.core = this
set this.dim = 2
return this
endmethod
endstruct
static if NEED_3D then
//Now the code of the 3D
struct MMS_3D extends array
boolean isZNotNull
real groundDamage
boolean jumpOverCliff
real zOffset
real zSpeed
real zAccel
real lastTerrainZ
real initTerrainZ
real unitInitialHeight
delegate MMS_Core core
method destroy takes nothing returns nothing
call this.core.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.core = this
set this.dim = 3
return this
endmethod
endstruct
//End of the code of the 3D
endif
static if NEED_4D then
//Now the code of the 4D
struct MMS_4D extends array
//What's the use of this one ?
boolean enabled
boolean lapseTime
boolean wasHidden
boolean rippOff
boolean blackHole
real aoe3D
real rippOffDamage
real blackHoleDamage
real rippOffSpeed
real blackHoleSpeed
delegate MMS_Core core
method destroy takes nothing returns nothing
call this.core.destroy()
endmethod
static method create takes nothing returns thistype
local thistype this = MMS_Core.create()
set this.core = this
set this.dim = 4
return this
endmethod
static method onInit takes nothing returns nothing
set dindex = -1
endmethod
endstruct
//End of the code of the 4D
endif
endlibrary
ummm, what code? if you are talking about the call blachblach 3D stuff, then yes, it is intendedStatic if will make the code unusable after the compile time.
what does it do?In mms_core struct add a member called dim like this :
whatAnd then in loop check this memer.
yes, duh? what you meanOfc you can wrap this into a static if WANT_3D but this will say that even the struct 3D will not be there.
if this.dim == 3 then
//Perform 3D code
elseif this.dim == 4 then
//Perform 4D code
endif
static if WANT_3D
if this.dim == 3 then
//Perform 3D code
endif
endif
static if WANT_4D
if this.dim == 4 then
//Perform 4D code
endif
endif