Hi
#11
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
Reply
#12
(06-24-2011, 07:38 AM)Eric Wrote: 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

That's pretty basic. Doesn't even do any thing.

Reply
#13
Well, blizzard give me a (hard) lua script.
Reply
#14
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.
Reply
#15
O.O




I won't be learning to script for a while…
[Image: finn_flag.gif]
Reply
#16
Ima horrible scripter. ! but welcome back Smile
[Image: dancerssssssss.gif]
Reply
#17
Except this time, you should stay-stay. Big Grin
[Image: poptartFINALTINY.gif]
[Image: log.png?t=1302647037]
Reply
#18
You keep leaving, it's no surprise...
Reply
#19
*reading magazine*

*Lift eyes up from magazine*

You back again? oh wait, you are inactive again

*while changing page* no surprise there

*keeps reading*
[Image: evil-dead-deer.gif]
Reply
#20

Not big suprise.
[Image: 76561198037039305.png]
[Image: nmdd7o.gif]
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)