Hi - Printable Version +- 2DWorlds Forums (http://2dworlds.buildism.net/forum) +-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4) +--- Forum: 2DWorlds Discussion (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=10) +--- Thread: Hi (/showthread.php?tid=6160) Pages:
1
2
|
RE: Hi - Eric - 06-24-2011 Lol, thats beginner lua. But If you can script something like this *I didn't do this* function Elemental_OnCombat(Unit, Event) Unit:SendChatMessage(13, 0, "Thunder will destroy you!") Unit:RegisterEvent("Elemental_Arc", 2000, 0) Unit:RegisterEvent("Elemental_Chain", 20000, 0) Unit:RegisterEvent("Elemetal_Shield", 10000, 0) Unit:RegisterEvent("Elemetal_Change", 1000, 1) Unit:RegisterEvent("SummonWater",1000, 1) Unit:RegisterEvent("SummonThunder", 1000, 1) Unit:RegisterEvent("SummonEarth", 1000, 1) Unit:RegisterEvent("Phase2", 1000, 1) end RE: Hi - Blizzard - 06-24-2011 (06-24-2011, 07:38 AM)Eric Wrote: Lol, thats beginner lua. But If you can script something like this That's pretty basic. Doesn't even do any thing. RE: Hi - Eric - 06-24-2011 Well, blizzard give me a (hard) lua script. RE: Hi - Blizzard - 06-24-2011 No real thing such as hard. But advanced would involve stuff like tables and coroutines, not just functions. [lua]virtual_map = {} virtual_map[1] = {name = "Place 1", ways = {down = 4, right = 2}} virtual_map[2] = {name = "Place 2", ways = {down = 5, left = 1, right = 3}} virtual_map[3] = {name = "Place 3", ways = {down = 6, left = 2}} virtual_map[4] = {name = "Place 4", ways = {up = 1, down = 7, right = 5}} virtual_map[5] = {name = "Place 5", ways = {up = 2, down = 8, left = 4, right = 6}} virtual_map[6] = {name = "Place 6", ways = {up = 3, down = 9, left = 5}} virtual_map[7] = {name = "Place 7", ways = {up = 4, right = 8}} virtual_map[8] = {name = "Place 8", ways = {up = 5, left = 7, right = 9}} virtual_map[9] = {name = "Place 9", ways = {up = 6, left = 8}} function create_searcher(value, way) local way = way or {} return {current = value, way = way} end function create_path(start, goal) local open_set = {create_searcher(start)} local closed_set = {} while #open_set > 0 do local new_finder = {} for index, value in pairs(open_set) do if virtual_map[value.current] then local ways = virtual_map[value.current].ways for key, content in pairs(ways) do if not closed_set[content] then closed_set[content] = true new_way = {} table.foreach(value.way, function(index, value) table.insert(new_way, value) end) table.insert(new_way, key) if content == goal then return new_way end table.insert(new_finder, create_searcher(content, new_way)) end end end end open_set = new_finder end print("Could not find a valid path from ", virtual_map[start].name, " to ", virtual_map[goal].name, ".") end[/lua] Not my code, couldn't be bothered fishing out one of my pieces of work. RE: Hi - sergentkyle - 06-24-2011 O.O I won't be learning to script for a while… RE: Hi - Fire - 06-24-2011 Ima horrible scripter. ! but welcome back RE: Hi - Login - 06-24-2011 Except this time, you should stay-stay. RE: Hi - lol - 06-24-2011 You keep leaving, it's no surprise... RE: Hi - Who - 06-24-2011 *reading magazine* *Lift eyes up from magazine* You back again? oh wait, you are inactive again *while changing page* no surprise there *keeps reading* RE: Hi - Fat_Sacks - 06-24-2011 Not big suprise. |