[System] RealitySys 2.0 - Make by 19101994

HiroshiKaze

Youtube Master Race
REALITY SYSTEM
version 2.0
19101994

Mã:
/*
=============================================================================
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
=============================================================================

||==||   ||=====     //\\     ||      II ======== \\  //
||  ||   ||         //  \\    ||      II    ||     \\//
||==\\   ||=====  =//====\\=  ||      II    ||      //
||   \\  ||       //      \\  ||      II    ||     //
||    \\ ||===== //        \\ ||===== II    ||    //            2.0

                                        ||=====|| \\  // ||=====||
                                        ||         \\//  ||
                                        ||=====||   //   ||=====||
                                               ||  //           ||
                                        ||=====|| //     ||=====||

=============================================================================
oO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*Oo
=============================================================================
||  M A K E     B Y     1 9 1 0 1 9 9 4
||          Update 23/11/2013
||-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
||      Requires:
||          Newgen 5d+
||          Warcraft 1.24e+
||-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
||      Instal:
||          + Copy Code
||          + goto trigger */RSmain/*
||              remove one */"/"/* of */"///! external ObjectMerger"/*
||              save map
||              close map
||              open map and  add */"/"/* back
||
||      VARs (available):
||          LOCUST      //rawcode
||          INVUL       //rawcode
||          CROWFORM    //rawcode
||          FREELOC     //you can use it for somethings
||      CONSTANTs (enum):
||          TEXT_ALL_EFFECT
||          TEXT_EFFECT_SIZE
||          TEXT_EFFECT_MOVE
||          TEXT_EFFECT_COLOR
||          TEXT_EFFECT_RUNTEXT
||          TEXT_EFFECT_READWORD
||          function functionTRUE takes nothing returns boolean     //default return true
||          function functionFALSE takes nothing returns boolean    //default return false
||      VARs (last created):
||          lastCreatedPosition
||          lastCreatedVector
||          lastCreatedObject
||          lastCreatedEffectS
||          lastCreatedDummy
||          lastCreatedDamage
||      CONFIGs:
||          ALLOW_ATTACK_ALLIED         //goto trigger:dmg
=============================================================================
oO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*OoO*Oo
=============================================================================
*/

P O S I T I O N
        real        .x
                    .x=
        real        .y
                    .y=
        real        .z
                    .z=
        static method create takes real x, real y, real z returns thistype
        static method GetUnitPos takes unit u returns thistype
        static method GetLocPos takes location l returns thistype
        method move takes real x, real y, real z returns nothing
        method destroy takes nothing returns nothing
        
V E C T O R
        real        .alpha      //alpha is angle in Oxy
                    .alpha=
        real        .beta       //beta is angle in Oxz or Oyz
                    .beta=
        static method create takes real x1, real y1, real z1, real x2, real y2, real z2 returns thistype
        static method CreateVectorWithPosition takes position pos1, position pos2 returns thistype
        static method GetVectorUnitFacing takes unit u returns thistype
        static method VectorBetweenPoints takes location a, location b returns thistype
        static method VectorBetweenUnits takes unit a, unit b returns thistype
        method destroy takes nothing returns nothing
        
O B J E C T
        integer     .CustomValue    //you can use for somethings
                    .CustomValue=
        static method create takes player id, integer unitid, real x, real y, real z, real angle returns thistype
        static method CreateAtPosition takes player id, integer unitid, position pos, real angle returns thistype
        static method CreateAtOffset takes player id, integer unitid, real x, real y, real angle returns thistype
        static method getStructId takes unit u returns integer
        method operator x takes nothing returns real
        method operator y takes nothing returns real
        method operator z takes nothing returns real
        method operator getPos takes nothing returns position
        method operator getPath takes nothing returns unit
        method Move takes position pos returns nothing
        method move takes real x, real y, real z returns nothing
        method RemoveObjectAfter takes real time returns nothing
        method destroy takes nothing returns nothing    //destroy struct, not remove unit
        method remove takes nothing returns nothing     //destroy struct and remove unit
        
E F F E C T S
        integer     .CustomValue    //you can use for somethings
        integer     .CustomValue=
        static method create takes real x, real y, real z returns thistype
        static method CreateAtUnit takes unit u returns thistype
        static method CreateAtPosition takes position pos returns thistype
        static method CreateAtOffset takes real x, real y returns thistype
        static method getStructId takes unit u returns integer
        method operator x takes nothing returns real
        method operator y takes nothing returns real
        method operator z takes nothing returns real
        method operator getPos takes nothing returns position
        method operator getPath takes nothing returns unit
        method add takes string modelName, string attachPointName returns effect    //add effect to path (1 effects more effect)
        method scale takes real scaleX, real scaleY, real scaleZ returns nothing
        method Move takes position pos returns nothing
        method move takes real x, real y, real z returns nothing
        method RemoveEffectSAfter takes real time returns nothing
        method remove takes nothing returns nothing //remove effects on path and recycle path for use again
        method destroy takes nothing returns nothing //recycle path, not remove effects
        
D U M M Y
        integer     .CustomValue
                    .CustomValue=
        static method create takes player id, integer unitid, real x, real y, real z, real angle returns thistype
        static method CreateAtUnit takes player id, integer unitid, unit u, real angle returns thistype
        static method CreateAtPosition takes player id, integer unitid, position pos, real angle returns thistype
        static method CreateAtOffset takes player id, integer unitid, real x, real y, real angle returns thistype
        static method getStructId takes unit u returns integer
        method add takes string modelName, string attachPointName returns effect    //add effect to path (1 dummy 1 effect), return bj_lastCreatedEffect
        method scale takes real scaleX, real scaleY, real scaleZ returns nothing
        method Move takes position pos returns nothing
        method move takes real x, real y, real z returns nothing
        method operator x takes nothing returns real
        method operator y takes nothing returns real
        method operator z takes nothing returns real
        method operator getPos takes nothing returns position
        method operator getPath takes nothing returns unit
        method operator getEfx takes nothing returns effect
        method RemoveDummyAfter takes real time returns nothing
        method destroy takes nothing returns nothing //destroy struct and remove path
        
T E X T
        readonly texttag    .tt //get   texttag
        readonly string     .s  //      string
        readonly real       .si //      size
        readonly real       .x
        readonly real       .y
        readonly real       .z
        readonly integer    .red
        readonly integer    .green
        readonly integer    .blue
        readonly integer    .alpha
                integer     .CustomValue
                            .CustomValue=
                            
                real        .dsize          //delta-size
                            .dsize=         //you can change it when Effect_readword is running
        readonly boolean    .effectSize     //InstalEffect(X,Y,Effect_size(Z)) => true and set .dsize=Z, else false
        
                real        .dx             //
                            .dx=            //
                real        .dy             //
                            .dy=            //
                real        .dz             //
                            .dz=            //
        readonly boolean    .effectMove     //InstalEffect(X,Y,Effect_move(Z,T,W)) => true (set .dx=Z, .dy=T, .dz=W), else false
        
                integer     .dred           //
                            .dred=          //
                integer     .dgreen         //
                            .dgreen=        //
                integer     .dblue          //
                            .dblue=         //InstalEffect(X,Y,Effect_color(Z,T,W,E)) then true
                integer     .dalpha         //then true
                            .dalpha=        //      (set .dred=Z, .dgreen=T, .dblue=W, .dalpha=E)
        readonly boolean    .effectColor    //else false
        
                boolean     .runRight       //
                            .runRight=      //
        readonly boolean    .effectRunText  //InstalEffect(X,Y,Effect_runtext(Z)) => true, else false
        
                string      .changer        //use for Effect_readword
                            .changer=       //you can change it when Effect_readword is running
        readonly boolean    .effectReadWord //InstalEffect(X,Y,Effect_readword(Z,T)) => true (set .changer=Z, |speed|=T), else false
        
        readonly boolean    .DESTROY        //destroy after running?
        readonly boolean    .STOP           //are effects running??
        
        readonly boolean    .destroyEFFECT1 //addEffectDestroy_default(TEXT_EFFECT_SIZE) => true, else false
        readonly boolean    .destroyEFFECT2 //                         TEXT_EFFECT_MOVE
        readonly boolean    .destroyEFFECT3 //                         TEXT_EFFECT_COLOR
        readonly boolean    .destroyEFFECT5 //                         TEXT_EFFECT_READWORD
        
        readonly static string array TEXT [95]
        
        static method create takes string t, real size, real x, real y, real z returns thistype
        static method CreateAtPosition takes string t, real size, position p returns thistype
        static method CreateAtLocation takes string t, real size, location l returns thistype
        static method CreateOnUnit takes string t, real size, unit u returns thistype
        static method CreateOnObject takes string t, real size, object o returns thistype
        static method CreateOnEffectS takes string t, real size, effects e returns thistype
        static method CreateOnDummy takes string t, real size, dummy d returns thistype
        method Move takes position p returns nothing
        method move takes real x, real y, real z returns nothing
        method color takes integer red, integer green, integer blue, integer alpha returns nothing
        method scale takes real size returns nothing
        method RemoveTextAfter takes real time returns thistype
        method show takes boolean b returns thistype
        method Effect_size takes real delta_size returns integer
        method Effect_move takes real delta_x, real delta_y, real delta_z returns integer
        method Effect_color takes integer delta_red, integer delta_green, integer delta_blue, integer delta_alpha returns integer
        method Effect_randomcolor takes nothing returns integer
        method Effect_runtext takes boolean runRight returns integer
        method Effect_readword takes string changer, integer speed returns integer
        method InstalEffect takes real delay, real duration, integer typeeffect returns thistype
        method startEffect takes nothing returns thistype
        method stopEffect takes integer typeeffect returns nothing
        method DestroyAfterRunning takes boolean b returns thistype
        method addEffectDestroy_default takes integer typeeffect returns thistype //just 0,1,2,3,5
        method addEffectCreate_default takes integer typeeffect returns thistype //just 1
        method destroy takes nothing returns nothing
        
D M G
   +---+integer .playerid       //use it when you cause dmg at location, position, ...
   |            .playerid=
   |    real    .x
   |            .x=
   |    real    .y
   |            .y=
   |    real    .z
   |            .z=
   +---+unit    .caster         //use it when you cause dmg on unit, effects, dummy, ...
                .caster=
        real    .d              //dmg (damage)
                .d=
        real    .aoe            //area of effect
                .aoe=
        attacktype  .at
                    .at=
        damagetype  .dt
                    .dt=
        group   .noDamage               //contain units which are not affect with this dmg
        real    .pcrit                  //percent-crit
                .pcrit=
        real    .pblock                 //percent-block
                .pblock=
        real    .pevade                 //percent-evade
                .pevade=
        real    .pd                     //if IsSuccess(pblock) then dmg = dmg * pd (0 <= pd <= 1)
                .pd=
        real    .xd                     //if IsSuccess(pcrit) then dmg = dmg * xd (xd >= 1)
                .xd=
        string  .functionEnd          //contain name of function which will run when finish causing-dmg or stop
                .functionEnd=
        
        readonly boolean STOP       //is dmg causing??
        readonly boolean dmgType    //false = At_Position, true = On_Unit
        static method create takes integer playerid, real x, real y, real z, real d, real aoe, attacktype at, damagetype dt returns thistype
        static method CreateAtPosition takes integer playerid, position p, real d, real aoe, attacktype at, damagetype dt returns thistype
        static method CreateAtOffset takes integer playerid, real x, real y, real d, real aoe, attacktype at, damagetype dt returns thistype
        static method CreateAtUnit takes integer playerid, unit whichUnit, real d, real aoe, attacktype at, damagetype dt returns thistype
        static method CreateAtPositionText takes integer playerid, text whichText, real d, real aoe, attacktype at, damagetype dt returns thistype
        static method CreateOnUnit takes unit whichUnit, real d, real aoe, attacktype at, damagetype dt returns thistype
        static method CreateOnObject takes object whichObject, real d, real aoe, attacktype at, damagetype dt returns thistype
        static method CreateOnEffectS takes effects whichEffectS, real d, real aoe, attacktype at, damagetype dt returns thistype
        static method CreateOnDummy takes dummy whichDummy, real d, real aoe, attacktype at, damagetype dt returns thistype
        method cause takes real delay, real duration returns thistype
        method stop takes nothing returns nothing
        method DestroyAfterRunning takes boolean b returns thistype
        method RemoveUnitFromGroupDamageAffect takes unit whichUnit returns thistype
        method RemoveUnitFromGroupNoDamageAffect takes unit whichUnit returns thistype
        method crit takes real percent, real xd returns thistype
        method block takes real percent, real pd returns thistype
        method evade takes real percent returns thistype
        method RunAfterEnding takes string functionName returns nothing
        method destroy takes nothing returns nothing
        
V E C T O R C++ <goto trigger:VectorCPlusPlus and config>   //see demoVectorC for more information
        static method create takes nothing returns thistype
        method operator push= takes $TYPE$ a returns nothing
        method operator pop takes nothing returns $TYPE$
        method operator [] takes integer p returns $TYPE$
        method operator []= takes integer p, $TYPE$ a returns nothing
        
Other functions:
    function PolarProjection3D takes position pos, real dist, vector ang returns position
    function DistanceBetweenPositions takes position pos1, position pos2 returns real
    function DistanceBetweenUnits takes unit a, unit b returns real
    function Distance3DBetweenUnits takes unit a, unit b returns real

Tên nghe rứa vậy chứ nó chỉ là 1 sys hổ trợ các chức năng phức tạp :9cool_haha: mà nếu bạn muốn làm thì sẽ khá là mệt hoặc thậm chí pó tay :9cool_too_sad:

Ví dụ:
- position thay cho location để có khả năng tạo 1 vị trí trong hệ trục tọa độ Oxyz thay vì Oxy như xưa

- đi kèm với nó đương nhiên phải có một thứ thay thế cho angle (real) cũ để có khả năng tính các góc trong Oxyz :1cool_look_down: và đây là lí do anh vector ra đời :9cool_haha:

- kế tiếp là các thằng hay xử dụng nhất là unit, effect :2cool_hell_boy: chúng được thay bởi object, effects (sr hết tên nên bỏ thêm chữ s = đặc biệt = special vào :9cool_too_sad:).
___object không chỉ có khả năng xử dụng các công dụng có sẵn của war với unit (chỉ việc var.getPath == lấy unit của Object và dùng như 1 unit bình thường) mà còn hổ trợ thêm một số hàm như Move hay move để di chuyển unit đến một tọa độ Oxyz mà bình thường bạn phải add Crow Form bla bla
___effects thì vốn là 1 unit (nếu chú nào biết tạo effect trên 1 unit dc cái hay gì thì cũng có thể tưỡng tượng ra dc cái này. nhưng hay hơn là sys hổ trợ add nh` effect trên 1 unit và recycle (tái xử dụng) các unit effects cũ. đương nhiên là nó cũng hổ trợ khả năng move trên Oxyz và hãy thử tượng tượng xem nếu kết hợp position, vector, và effects thì bạn sẽ làm dc khá nh` spell có liên quan đến vụ bay bay mà mỗi lần làm là 1 lần cực :9cool_haha:

- vâng đã tiếp thị xong 2 đứa kia, và nếu ai đã đọc các functions trên kia và HIỂU thì chắc sẽ có ng` thắc mắc tại sao có thêm thằng dummy... đơn giản là nó lai 1 chút của object và 1 chút của effects với lại tôi muốn khỏi nhầm tới nhầm lui giữa mấy đứa nó nên tách ra...:5cool_sweat: (xin đừng có ném gạch)

- tới thằng này bảo đảm bạn sẽ ghiền! text thay cho texttag hay Floating Text trong GUI. hổ effect khi mới tạo như sáng chữ dần, chạy từ random đến khi đúng string nhập vào, v.v... (đọc functions bên trên để biết thêm chi tiết), và nó cũng hổ trợ effect trong ghi đang hiện hành bla bla. một điều đương nhiên là cũng hổ trợ effect khi xóa nó. :2cool_hell_boy:

- dmg, tạo damage chỉ với 1-2 dòng bạn có thể tạo 1 damage xảy ra ở một vị trí nào đó trong 1 khoản thời gian X với delay lặp mỗi lần Y, hay tạo 1 damage trên 1 target và rút máu nó như spell rút đọc :1cool_look_down: bla bla :5cool_big_smile:

- cuối cùng là thằng vector c++, ai xài nó bên c++ thì cũng biết công dụng rùi nhưng tôi sẽ nói lại để PR cái này thêm chút :6cool_smile: (PR công khai), nó xài như mảng bình thường nhưng khá tiện, nó có thể tạo mảng N chiều nhưng không cần khai báo trước số lượng phần tử, bạn có thể push, pop như 1 stack, chạy loop như 1 var bt. Ví dụ: vectorUnit a có 5 unit trong đó bạn có thể chạy for(i:0->5) a để xử lí các unit bên trong a. có điều rằng bạn nên biết, vì sự tiện lợi đó của nó nên nó chạy chậm hơn nếu xài mảng bình thường (chuyện đương nhiên thôi) :2cool_sad:

Link download: https://www.mediafire.com/download/4j7c5qwj58qggyy/RealitySys.w3x

P/s: Ai xử dụng thì góp ý cho mềnh ngay bên dưới bài viết này! Ai thắc mắc gì thì cũng cmt dưới đây mình sẽ giải đáp!!!
 
ở đây toàn là newbie xì phàm thui ::3cool_shame: chứ lão làng hay xài vjass thì toàn nghỉ WE hết rùi :2cool_burn_joss_sti nên chú đăng cái này cũng hok ai quan tâm cả :9cool_too_sad:
 
Back
Top