• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

CR - Main

JASS:
library Main
#include "cj_types.j"
#include "cj_order.j"

define {
    GetHp(u) = GetUnitState(u, ConvertUnitState(0))
    GetMp(u) = GetUnitState(u, ConvertUnitState(2))
    SetHp(u,n) = SetUnitState(u, ConvertUnitState(0), n)
    SetMp(u,n) = SetUnitState(u, ConvertUnitState(2), n)
    GetMaxHp(u) = GetUnitState(u, ConvertUnitState(1))
    GetMaxMp(u) = GetUnitState(u, ConvertUnitState(3))
    SetMaxHp(u,n) = SetUnitState(u, ConvertUnitState(1), n)
    SetMaxMp(u,n) = SetUnitState(u, ConvertUnitState(3), n)
    Chance(ch) = (GetRandomReal(0.01, 100.) <= ch)
    Clear(h) = FlushChildHashtable(Ud, GetHandleId(h))
    GetData(v) = GetUnitUserData(v)
    SetData(v,d) = SetUnitUserData(v, d)
    GetItemData(v) = GetItemUserData(v)
    SetItemData(v,d) = SetItemUserData(v, d)
    GetTimerAttach(h) = R2I(TimerGetRemaining(h)+0.5)
    SaveUnit(h,u) = SaveUnitHandle(hash, GetHandleId(h), 0, u)
    LoadUnit(h) = LoadUnitHandle(hash, GetHandleId(h), 0)
    SaveEffect(h, u) = SaveEffectHandle(hash, GetHandleId(h), 0, u)
    LoadEffect(h) = LoadEffectHandle(hash, GetHandleId(h), 0)
    Erase(h) = FlushChildHashtable(hash, GetHandleId(h))
    H2I(h) = GetHandleId(h)
    CT = CreateTimer()
    CG = CreateGroup()
    DG(g) = DestroyGroup(g)
    GC(g) = GroupClear(g)
    PT(t) = PauseTimer(t)
    DT(t) = DestroyTimer(t)
    Gx(a) = GetUnitX(a)
    Gy(a) = GetUnitY(a)
    Ga(a) = GetUnitFacing(a)
    Rx(x,a) = (x * Cos(a * DEGTORAD))
    Ry(x,a) = (x * Sin(a * DEGTORAD))
    RndAng = GetRandomReal(0., 360.)
    RndI(a, b) = GetRandomInt(a, b)
    RndR(a, b) = GetRandomReal(a, b)
    Pass = Player(15)
    NewDummy(x,y) = CreateUnit(Pass, ED, x, y, RndAng)
    msg(s) = DisplayTextToForce(bj_FORCE_ALL_PLAYERS, s)
    TimerStartEx(whichTimer, period, handlerFunc, userData) = {
            TimerStart(whichTimer, I2R(userData), false, null) // timer exploit, xgm 2007, by Scorpio
            PauseTimer(whichTimer)
            TimerStart(whichTimer, period, false, handlerFunc )
    }
    //=====================================
    ED = 'h000'
    SS = 'A000'
    Hero = udg_HeroRed
    BLIND_ID = 'A00R'
    IGNORE_ID = 'A00Z'
    Root_Id = 'A011'
    ATTACK_ID = 'A014'
    RANGE_ATTACK_ID = 'A01D'
}

//globals
    hashtable hash = InitHashtable()
    int TempInt
    timer TempTimer
    effect TempEffect
    unit TempUnit1, TempUnit2
    location Loc = Location(0.,0.)
    string Str
    constant real DEGTORAD = 3.14159 / 180.

endlibrary
Top