Giter Club home page Giter Club logo

war3_lua's Introduction

War3 Lua - 1.3.8 (Blight)

lua warcraft license forks

War3 Lua - modification that allows you to run lua scripts at the JASS level. Lua does not replace the original scripting system in the game, but only expands its capabilities.

Some natives doesn't work (thx jass for beautiful VM).

Pictures

Usage

Just create war3map.lua and move into your map. You can use fast code testing by including external script. Don't forget to use developer mode to unlock some features.

war3map.lua

require "script"

script.lua

local unit = CreateUnit(Player(0), FourCC("Hpal"), 0, 0, 0) --> Creating unit
SetUnitColor(unit, ConvertPlayerColor(1)) --> Changing color

If you wanna display some text, use "print" to type it in the chat, and "printc" to display text in console. Don't forget to use console mode.

Example

There's a little code to showing jass leaks and memory that's being used by the lua machine.

local ITERATION_COUNT = 100;
TimerStart(CreateTimer(), 0, false, function()
	statisticLeaderboard = CreateLeaderboard();
	LeaderboardSetLabel(statisticLeaderboard,  "Debug stats");
	PlayerSetLeaderboard(GetLocalPlayer(), statisticLeaderboard);
	LeaderboardDisplay(statisticLeaderboard, true);

	LeaderboardAddItem(statisticLeaderboard,"Handles", 0, Player(0))
	LeaderboardAddItem(statisticLeaderboard,"Used memory", 0, Player(1))

	LeaderboardSetSizeByItemCount(statisticLeaderboard, 2);

	TimerStart(GetExpiredTimer(), 0.1, true, function()
		local result = 0
		local min = -1
		local locs = {}

		for i = 1, ITERATION_COUNT do
			local loc = Location(0, 0)
			locs[i] = loc
	      
	       	local id = GetHandleId(loc)
	       	id = id - 0x100000

	       	if min == -1 then
				min = id
			end
			
			if id > result then
				result = id
			elseif id < min then
				min = id
			end
		end

		if result - min > ITERATION_COUNT then
			result = min
		else
			result = result - ITERATION_COUNT
		end

		for i = 1, #locs do
			RemoveLocation(locs[i])
		end

		LeaderboardSetItemValue(statisticLeaderboard, 0, R2I(result));
    	LeaderboardSetItemValue(statisticLeaderboard, 1, R2I(collectgarbage("count")));
	end)
end)

Installation

  • Move the folder Scripts, Maps and war3_lua.mix to the game folder
  • Run the game (type "-dev" to activate developer mode and "-console" to use console)
  • Open the map with war3map.lua file inside

License

This modification is available as open source under the terms of the MIT License.

war3_lua's People

Contributors

ev3nt avatar evcup avatar kirill-782 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.