Warcraft Lua Engine [1.0.4]

This is a discussion on Warcraft Lua Engine [1.0.4] within the Warcraft 3 Hacks, bots and tools board part of the Warcraft 3 forum category; Hello Guys, Yes ! that's right, an " lua script engine " for Warcraft3 for the first time ! So ...

Page 1 of 9 123 ... LastLast
Results 1 to 10 of 84
  1. #1
    Sosha is offline Banned User

    Array
    Join Date
    Oct 2011
    Location
    Iran
    Posts
    524
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    1043

    Warcraft Lua Engine [1.0.4]

    Hello Guys,

    Yes ! that's right, an "lua script engine" for Warcraft3 for the first time
    !

    So just let's get started :

    Q : What the hell is this ?!
    A : An External lua scripting engine for warcraft3 which everyone can write their custom scripts for it

    Q : Are you kidding me ?
    A : NO :|

    Let's just talk about how actually it works
    All you have to do is just to copy engine files to your warcraft folder and put your scripts in "Scripts" folder, the game will automatically search for *.lua files and load them and yes it's possible to run multiple scripts because each works in its own separate thread.

    Q : Is there any documentation or reference for functions ?
    A : Just go on with reading I will explain

    CURRENTLY I have implemented two different classes with some functions. CGame and CJass and some general functions

    CGame
    includes custom made functions
    CJass
    includes native Jass functions

    Q : What are the functions ?
    A : Here they are
    CGame :
    Code:
    int GetGameState() // Return value will be GS.NOTHING, GS.LOBBY, GS.LOADING, GS.INGAME or GS.PAUSED
    int GetLocalPlayerNumber() // Returns your slot number in game
    void PauseGame()    // Pause the game
    void ResumeGame()  // Resume the game
    void SelectUnit(hUnit) // Selects the unit
    void SendCommand(hUnit, cmdID, X, Y, hTargetUnit) // cmdID can be "CMD.MOVE", "CMD.ATTACK", "CMD.HOLD" and "CMD.STOP". hTargetUnit can be set to null (0) in MOVE, HOLD and STOP situations.
    float GetUnitStat(hUnit, StatID) // StatID can be "STAT.HP", "STAT.MAXHP", "STAT.MANA" and "STAT.MAXMANA"
    float Distance(location1, location2) // Returns distance between Unit1 and Unit2
    location GetUnitLocation(hUnit) // Returns handle of unit location
    unit GetSelectedUnit() // Returns handle of selected unit
    player GetLocalPlayer() // Returns local player handle that only can be used in game class
    player GetPlayerByNumber(PlayerSlotNumber) // Returns player handle by it's slot number
    player GetOwningPlayer(hUnit) // Get owning player of unit(NEW !)
    bool IsHero(hUnit) // Check if unit is hero or not
    bool IsUnitOwnedByPlayer(hPlayer, hUnit) // Check if hUnit is owned by hPlayer or not
    bool IsPlayerEnemy(hPlayer1, hPlayer2) // Check if these players are enemies to each other (NEW !)
    bool IsDead(hUnit) // Check if unit is dead or not
    bool IsUnitVisibleToPlayer(hUnit, hPlayer) // Check if unit is visible to player  (NEW !)
    LuaTable GetAllUnits() // Returns a table of all units in game
    LuaTable GetDotaUnits() // Returns a table of all dota creeps in game
    CJass :
    Code:
    ChangeLevel;
    ClearSelection;
    ClearTextMessages;
    ConvertPlayerScore;
    ConvertPlayerSlotState;
    ConvertPlayerState;
    ConvertRace;
    CreateTextTag;
    DialogAddButton;
    DialogAddQuitButton;
    DialogCreate;
    DialogDisplay;
    DialogSetMessage;
    DisplayTimedTextToPlayer;
    DoNotSaveReplay;
    GetHeroLevel;
    GetLocalPlayer;
    GetOwningPlayer;
    GetPlayerColor;
    GetPlayerId;
    GetPlayerName;
    GetPlayerRace;
    GetPlayerScore;
    GetPlayerSlotState;
    GetPlayerState;
    GetTriggerUnit;
    GetUnitName;
    GetUnitX;
    GetUnitY;
    IsFoggedToPlayer;
    IsMaskedToPlayer;
    IsPlayerAlly;
    IsPlayerEnemy;
    IsPlayerObserver;
    IsUnitAlly;
    IsUnitEnemy;
    IsUnitVisible;
    IsVisibleToPlayer;
    PauseGame;
    PingMinimap;
    PingMinimapEx;
    Player;
    SelectUnit;
    SetTextTagColor;
    SetTextTagFadepoint;
    SetTextTagLifespan;
    SetTextTagPermanent;
    SetTextTagPosUnit;
    SetTextTagText;
    SetTextTagVelocity;
    SetTextTagVisibility;
    General Functions :
    Code:
    ShowMessage(string text) // Display a messagebox with given text
    Sleep(int Milliseconds) // Equals to WINAPI Sleep function with some modifications and improvements
    Debug(int Code) // Display a messagebox with a given number (useful for showing functions return codes)
    MouseClick("button", x, y, clicks, speed) // Equals to Autoit MouseClick function
    KeyPress("keys") // Equals to Autoit Send function
    Please note that you can not use any Unit or Player handle returned from CGame in CJass class. (and vice versa)

    Changelog:
    Code:
    1.0.0
     - Initial release
    
    1.0.1
     - Added MouseClick and KeyPress functions (a sample script has beed added to archieve to show how to work with them)
    
    1.0.2
    - Now I'm using LuaJit (5.1) instead of Lua 5.2
    - Added more functions for CGame class
    - Added GetUnitName and GetPlayerName to CJass class functions
    - Now it's possible to get strings returned by Jass functions that returns string
    
    1.0.3
    - Fixed some important bug
    
    1.0.4
    - Added more functions
    Everyday I come with an update and more functions

    Q : Is there any sample script ?
    A : Yes, you can find them in "Scripts" folder



    "To disable an script just change it's extension from lua to something else (like xxx)"

    "DON'T FORGET to post your scripts here, we will appreciate them and also SUGGEST functions that you find useful to be added to engine"

    Q : Is there any credits ?
    A : Yes,
    kolkoo for 70% of CGame functions and autoit developer for some automation functions

    Q : Source code available ?
    A : Github Repository

    Q : Can I finally download it ?
    A : Of course !
    Attached Files
    Last edited by Sosha; 12-30-2013 at 02:42 PM. Reason: Updating to 1.0.4


  2. #2
    Tracky's Avatar
    Tracky is offline Administrator

    Array
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    9,964
    Mentioned
    176 Post(s)
    Tagged
    4 Thread(s)
    Rep Power
    44
    Reputation
    5675
    Wow, that looks like an AWESOME share!
    I guess I'll have a look at it soon, it just seems too good! Great share. well deserved
    I hope you'll continue to develop it!

  3. The Following 2 Users Say Thank You to Tracky For This Useful Post:


  4. #3
    Flash's Avatar
    Flash is offline Premium Member

    Array
    Join Date
    May 2012
    Posts
    1,624
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    12
    Reputation
    865
    I have no idea what this does but rest assured, Sosha always has something great in store for us. Glad you're still alive and active in WC3.

  5. The Following 3 Users Say Thank You to Flash For This Useful Post:


  6. #4
    dapeng_zi's Avatar
    dapeng_zi is offline Master Hacker

    Array
    Join Date
    Oct 2009
    Location
    Washington D.C.
    Posts
    545
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    10
    Reputation
    151
    Mind blown.

  7. The Following 2 Users Say Thank You to dapeng_zi For This Useful Post:


  8. #5
    bedman is offline Wannabe Member
    Array
    Join Date
    Jan 2010
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    10
    Reputation
    3
    file GameState is 666 bytes long

  9. #6
    MountainDew's Avatar
    MountainDew is offline Mentor
    Array
    Join Date
    Feb 2012
    Posts
    138
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    8
    Reputation
    154
    Multiboard functions
    Environment functions (change water color, weather, etc)
    Force UI Key, Force UI Cancel
    Sound - Stop Music
    Sound - Play Sound (idk if the sounds need to be included in the map or not)

    Text out to all players.
    Print text to screen.

    Give players gold, lumber.

    Does creating a new trigger desync you? I forget, I haven't mapped in a while.
    If you could, then you could have a plethora of conditional triggers while you play a map.

    Lastly, can you do mouse clicks? o_o
    Can you call DLLs? Like user32 hehe
    If so, then with a function to convert game coords to screen coords, omg.

    It seems like this is an engine for scripting automation/alerts for assisted botting, am I wrong?
    Last edited by MountainDew; 11-06-2013 at 12:41 AM.

  10. The Following User Says Thank You to MountainDew For This Useful Post:


  11. #7
    Sosha is offline Banned User

    Array
    Join Date
    Oct 2011
    Location
    Iran
    Posts
    524
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    1043
    I'm not sure about PlaySound function, I think sound should be in map file
    Here is blizzard jass function for playing a sound
    Code:
    function PlaySound takes string soundName returns nothing
         local sound soundHandle = CreateSound(soundName, false, false, true, 12700, 12700, "") 
        call StartSound(soundHandle)     
    call KillSoundWhenDone(soundHandle) 
    endfunction
    Creating triggers is still a mystery for me because,

    Code:
    native TriggerAddAction     takes trigger whichTrigger, code actionFunc returns triggeraction
    I really have no idea what should be passed to this argument and I tried anything -___- but that should be a pointer to a jass function (not a c++ functions that contains jass functions)

    And about MouseClick and Call from dlls, yes why not ?!

    Anyway, are you guys agree to complete this project together ? if yes I will create a github repository for it

  12. The Following 2 Users Say Thank You to Sosha For This Useful Post:


  13. #8
    ghost_'s Avatar
    ghost_ is offline Guru
    Array
    Join Date
    Mar 2010
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    10
    Reputation
    8
    Unbenannt.png

    Get this Error when opening Warcraft III.
    Last edited by Sosha; 11-06-2013 at 10:45 AM.

  14. #9
    Sosha is offline Banned User

    Array
    Join Date
    Oct 2011
    Location
    Iran
    Posts
    524
    Mentioned
    39 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    1043
    Quote Originally Posted by ghost_ View Post
    Unbenannt.png

    Get this Error when opening Warcraft III.
    1- You should have 1.26 patch
    2- There may be some problem with your scripts, did you create any script or changed sample scripts ?if yes so they have syntax error, post them here

  15. The Following 2 Users Say Thank You to Sosha For This Useful Post:


  16. #10
    MountainDew's Avatar
    MountainDew is offline Mentor
    Array
    Join Date
    Feb 2012
    Posts
    138
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    8
    Reputation
    154
    I'd be crazy interested in mouse clicks and key presses. With the mouse clicks, we'd need a function to convert the game coordinates to screen coordinates.

    I'll post some of my scripts once I come up with an idea.

  17. The Following User Says Thank You to MountainDew For This Useful Post:


Page 1 of 9 123 ... LastLast

Similar Threads

  1. [Help] WarCraft III Battle Net Cheat Engine need help
    By Edward_ in forum Warcraft 3 Hacks, bots and tools
    Replies: 3
    Last Post: 01-10-2011, 05:04 AM
  2. Engine?
    By T0nik in forum KalOnline
    Replies: 1
    Last Post: 12-02-2010, 09:48 PM
  3. Cheat engine highest version and hundreads of cheats if u have cheat engine
    By kabarastar in forum WoW Private Server Hacks
    Replies: 22
    Last Post: 12-31-2008, 03:44 AM
  4. Need help with Cheat Engine + Warcraft 3
    By Tonyt32136 in forum Warcraft 3 forum
    Replies: 0
    Last Post: 09-27-2007, 09:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •