Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------------------------
- -------------------------------------------------------
- --Ludo Script by Shaddow, for you!
- --
- --Needs LSA Link: http://pastebin.com/jYDX4yPr
- --
- --
- --Last Update: 13/11/2011 (DD/MM/YYYY)
- -------------------------------------------------------
- -------------------------------------------------------
- --[[ -- SQL --
- INSERT INTO `creature_names` VALUES ('521120', 'Ludo!', '', '', '0', '10', '0', '0', '0', '0', '347', '0', '0', '0', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `creature_names` VALUES ('521121', 'Red NPC', '', '', '0', '10', '0', '0', '0', '0', '5488', '0', '0', '0', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `creature_names` VALUES ('521122', 'Green NPC', '', '', '0', '10', '0', '0', '0', '0', '14527', '0', '0', '0', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `creature_names` VALUES ('521123', 'Yellow NPC', '', '', '0', '10', '0', '0', '0', '0', '18404', '0', '0', '0', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `creature_names` VALUES ('521124', 'Blue NPC!', '', '', '0', '10', '0', '0', '0', '0', '13444', '0', '0', '0', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `creature_proto` VALUES ('521120', '1', '1', '35', '100', '100', '0', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '', '0', '0', '0', '2.5', '8', '14', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `creature_proto` VALUES ('521121', '1', '1', '35', '100', '100', '0', '0.7', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '', '0', '0', '0', '2.5', '8', '14', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `creature_proto` VALUES ('521122', '1', '1', '35', '100', '100', '0', '0.5', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '', '0', '0', '0', '2.5', '8', '14', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `creature_proto` VALUES ('521123', '1', '1', '35', '100', '100', '0', '0.3', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '', '0', '0', '0', '2.5', '8', '14', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `creature_proto` VALUES ('521124', '1', '1', '35', '100', '100', '0', '0.2', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '', '0', '0', '0', '2.5', '8', '14', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');
- INSERT INTO `gameobject_names` VALUES ('505504', '5', '5411', 'Ludo gamefield', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0');
- INSERT INTO `gameobject_names` VALUES ('505501', '5', '264', 'Red Aura', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0');
- INSERT INTO `gameobject_names` VALUES ('505502', '5', '3612', 'Green Aura', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0');
- INSERT INTO `gameobject_names` VALUES ('505503', '5', '1310', 'Yellow Aura', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0');
- INSERT INTO `gameobject_names` VALUES ('505500', '5', '1309', 'Blue Aura', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0');
- ]]
- local NPCID_LUDO = 521120 --Main NPC EntryID
- local COLOR_BLUE_NPC = 521124 --Blue NPC EntryID
- local COLOR_GREEN_NPC = 521122 --Green NPC EntryID
- local COLOR_RED_NPC = 521121 --Red NPC EntryID
- local COLOR_YELLOW_NPC = 521123 --Yellow NPC EntryID
- local GAMEFIELD_OBJ = 505504 --Gamefield Object EntryID
- local COLOR_BLUE_OBJ = 505500 --Blue Object EntryID
- local COLOR_GREEN_OBJ = 505502 --Green Object EntryID
- local COLOR_RED_OBJ = 505501 --Red Object EntryID
- local COLOR_YELLOW_OBJ = 505503 --Yellow Object EntryID
- local wintab = {--here you can add items for the player who wins this match:
- --{ITEMID, ITEMCOUNT},
- }
- local REGISTERSOUND = 8462 --Player join sound ID
- local STARTSOUND = 8463 --Player start sound ID
- local PLAYERMAX = 2 --playercap, default: 4 (Max: 4 Min: 2)
- local rdymsg = "#bereit" --ready message
- --Menunames:
- local menu1 = "Anmelden"
- local menu2 = "Abmelden"
- local menu3 = "Beenden"
- local menu4 = "Bewegen"
- local menu5 = "W\195\188rfeln"
- local menu6 = "Ins Spielfeld bringen"
- local menu7 = "Zug weitergeben"
- local menu8 = "Aufgeben"
- local color_blue = "Blau"
- local color_green = "Gr\195\188n"
- local color_red = "Rot"
- local color_yellow = "Gelb"
- --Main NPC name:
- local mainnpcname = "Ludo"
- --Gamemessages:
- local message1 = "Derzeit kannst du dich nicht anmelden!"
- local message2 = "Bitte #bereit schreiben, um das Spiel zu beginnen!"
- local message3 = "Warte auf Gegner..."
- local message4 = "Spiel beginnt!"
- local message5 = "NAME ist dran."
- local message6 = "NAME f\195\164ngt an. (Du bist COLOR)"
- local message7 = "Du hast bereits gew\195\188rfelt."
- local message8 = "NAME hat eine NUMBER gew\195\188rfelt."
- local message9 = "Du musst zuerst w\195\188rfeln."
- local message10 = "Du musst eine 6 w\195\188rfeln."
- local message11 = "Du kannst diese Figur nicht bewegen!"
- local message12 = "NAME darf noch NUMBER mal."
- local message13 = "NAME hat den NUMBER Platz belegt."
- local message14 = "NAME wurde aus dem Spiel entfernt!"
- local message15 = "NAME hat leider verloren."
- local message16 = "NAME darf nochmal w\195\188rfeln."
- local message17 = "Jemand hat sich abgemeldet, ihr wurdet erstrangig der Warteschleife hinzugef\195\188gt."
- local gamefield = {--{ENTRYID, X, Y, Z, O, SCALE}, ONLY NPC Coords+XYZ
- {GAMEFIELD_OBJ, 20, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 16, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 12, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 8, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, -8, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, -12, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, -16, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, -20, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 0, -20, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, -20, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, -16, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, -12, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, -8, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -8, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -12, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -16, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -20, -4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -20, 0, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -20, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -16, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -12, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -8, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, 8, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, 12, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, 16, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, -4, 20, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 0, 20, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, 20, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, 16, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, 12, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, 8, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 4, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 8, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 12, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 16, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 20, 4, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 20, 0, 0, 0, 0.80, "field"},
- {GAMEFIELD_OBJ, 16, 0, 0, 0, 0.80, "winblue"},
- {GAMEFIELD_OBJ, 12, 0, 0, 0, 0.80, "winblue"},
- {GAMEFIELD_OBJ, 8, 0, 0, 0, 0.80, "winblue"},
- {GAMEFIELD_OBJ, 4, 0, 0, 0, 0.80, "winblue"},
- {GAMEFIELD_OBJ, -16, 0, 0, 0, 0.80, "wingreen"},
- {GAMEFIELD_OBJ, -12, 0, 0, 0, 0.80, "wingreen"},
- {GAMEFIELD_OBJ, -8, 0, 0, 0, 0.80, "wingreen"},
- {GAMEFIELD_OBJ, -4, 0, 0, 0, 0.80, "wingreen"},
- {GAMEFIELD_OBJ, 0, 16, 0, 0, 0.80, "winred"},
- {GAMEFIELD_OBJ, 0, 12, 0, 0, 0.80, "winred"},
- {GAMEFIELD_OBJ, 0, 8, 0, 0, 0.80, "winred"},
- {GAMEFIELD_OBJ, 0, 4, 0, 0, 0.80, "winred"},
- {GAMEFIELD_OBJ, 0, -16, 0, 0, 0.80, "winyellow"},
- {GAMEFIELD_OBJ, 0, -12, 0, 0, 0.80, "winyellow"},
- {GAMEFIELD_OBJ, 0, -8, 0, 0, 0.80, "winyellow"},
- {GAMEFIELD_OBJ, 0, -4, 0, 0, 0.80, "winyellow"},
- {COLOR_YELLOW_OBJ, -20, -20, 0, 0, 0.80, "spawnyellow"},
- {COLOR_YELLOW_OBJ, -20, -16, 0, 0, 0.80, "spawnyellow"},
- {COLOR_YELLOW_OBJ, -16, -20, 0, 0, 0.80, "spawnyellow"},
- {COLOR_YELLOW_OBJ, -16, -16, 0, 0, 0.80, "spawnyellow"},
- {COLOR_BLUE_OBJ, 20, -20, 0, 0, 0.80, "spawnblue"},
- {COLOR_BLUE_OBJ, 20, -16, 0, 0, 0.80, "spawnblue"},
- {COLOR_BLUE_OBJ, 16, -20, 0, 0, 0.80, "spawnblue"},
- {COLOR_BLUE_OBJ, 16, -16, 0, 0, 0.80, "spawnblue"},
- {COLOR_GREEN_OBJ, -20, 20, 0, 0, 0.80, "spawngreen"},
- {COLOR_GREEN_OBJ, -20, 16, 0, 0, 0.80, "spawngreen"},
- {COLOR_GREEN_OBJ, -16, 20, 0, 0, 0.80, "spawngreen"},
- {COLOR_GREEN_OBJ, -16, 16, 0, 0, 0.80, "spawngreen"},
- {COLOR_RED_OBJ, 20, 20, 0, 0, 0.80, "spawnred"},
- {COLOR_RED_OBJ, 20, 16, 0, 0, 0.80, "spawnred"},
- {COLOR_RED_OBJ, 16, 20, 0, 0, 0.80, "spawnred"},
- {COLOR_RED_OBJ, 16, 16, 0, 0, 0.80, "spawnred"},
- {COLOR_YELLOW_OBJ, -4, -20, 0, 0, 0.80, "startyellow"},
- {COLOR_RED_OBJ, 4, 20, 0, 0, 0.80, "startred"},
- {COLOR_GREEN_OBJ, -20, 4, 0, 0, 0.80, "startgreen"},
- {COLOR_BLUE_OBJ, 20, -4, 0, 0, 0.80, "startblue"},
- {GAMEFIELD_OBJ, -20, -20, 0, 0, 0.80},
- {GAMEFIELD_OBJ, -20, -16, 0, 0, 0.80},
- {GAMEFIELD_OBJ, -16, -20, 0, 0, 0.80},
- {GAMEFIELD_OBJ, -16, -16, 0, 0, 0.80},
- {GAMEFIELD_OBJ, 20, -20, 0, 0, 0.80},
- {GAMEFIELD_OBJ, 20, -16, 0, 0, 0.80},
- {GAMEFIELD_OBJ, 16, -20, 0, 0, 0.80},
- {GAMEFIELD_OBJ, 16, -16, 0, 0, 0.80},
- {GAMEFIELD_OBJ, -20, 20, 0, 0, 0.80},
- {GAMEFIELD_OBJ, -20, 16, 0, 0, 0.80},
- {GAMEFIELD_OBJ, -16, 20, 0, 0, 0.80},
- {GAMEFIELD_OBJ, -16, 16, 0, 0, 0.80},
- {GAMEFIELD_OBJ, 20, 20, 0, 0, 0.80},
- {GAMEFIELD_OBJ, 20, 16, 0, 0, 0.80},
- {GAMEFIELD_OBJ, 16, 20, 0, 0, 0.80},
- {GAMEFIELD_OBJ, 16, 16, 0, 0, 0.80},
- {COLOR_BLUE_OBJ, 4, 0, 0, 0, 1},
- {COLOR_BLUE_OBJ, 8, 0, 0, 0, 1},
- {COLOR_BLUE_OBJ, 12, 0, 0, 0, 1},
- {COLOR_BLUE_OBJ, 16, 0, 0, 0, 1},
- {COLOR_GREEN_OBJ, -4, 0, 0, 0, 1},
- {COLOR_GREEN_OBJ, -8, 0, 0, 0, 1},
- {COLOR_GREEN_OBJ, -12, 0, 0, 0, 1},
- {COLOR_GREEN_OBJ, -16, 0, 0, 0, 1},
- {COLOR_RED_OBJ, 0, 4, 0, 0, 1},
- {COLOR_RED_OBJ, 0, 8, 0, 0, 1},
- {COLOR_RED_OBJ, 0, 12, 0, 0, 1},
- {COLOR_RED_OBJ, 0, 16, 0, 0, 1},
- {COLOR_YELLOW_OBJ, 0, -4, 0, 0, 1},
- {COLOR_YELLOW_OBJ, 0, -8, 0, 0, 1},
- {COLOR_YELLOW_OBJ, 0, -12, 0, 0, 1},
- {COLOR_YELLOW_OBJ, 0, -16, 0, 0, 1},
- }
- ------------------------------------------------------------------------
- -------------------------------Tables-----------------------------------
- local ludo = {}
- ludo.register = {}
- ludo.game = {}
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- math.randomseed(os.clock())
- ------------------------------------------------------------------------
- -------------------------------MainNPC----------------------------------
- function LudoNPC_Gossip(unt, _, plr)
- unt:GossipCreateMenu(1, plr, 0)
- if(ludo.game.plrs~=nil)then
- if(plr:GetName()==ludo.game.plrs[ludo.game.round][2])then
- unt:GossipMenuAddItem(3,menu7,4,0)
- unt:GossipMenuAddItem(3,menu5.."\n",3,0)
- end
- end
- if(LSA.tabsearch(ludo.register, plr:GetName()))then
- unt:GossipMenuAddItem(3,menu2,2,0)
- else
- if(ludo.game.plrs==nil)then
- unt:GossipMenuAddItem(3,menu1.." "..table.getn(ludo.register).."/"..PLAYERMAX,1,0)
- end
- end
- if(ludo.game.plrs~=nil)then
- for k,v in pairs(ludo.game.plrs)do
- if(v[2]==plr:GetName())then
- unt:GossipMenuAddItem(3,menu8,5,0)
- end
- end
- end
- unt:GossipMenuAddItem(7,"["..menu3.."]", 99, 0)
- unt:GossipSendMenu(plr)
- end
- function LudoNPC_Select(unt, _, plr, _, id, code)
- if(id==1)then
- plr:GossipComplete()
- if(table.getn(ludo.register)<PLAYERMAX)and(ludo.game.plrs==nil)then
- plr:PlaySoundToPlayer(REGISTERSOUND)
- table.insert(ludo.register, plr:GetName())
- if(table.getn(ludo.register)>=PLAYERMAX)then
- ludo.game.rdy = true
- ludo.game.diced = false
- ludo.game.rdys = {}
- ludo.game.unt = unt
- ludo.game.x = unt:GetX()
- ludo.game.y = unt:GetY()
- ludo.game.z = unt:GetZ()
- ludo.game.gametyp = "rdy"
- for x=1,PLAYERMAX,1 do
- GetPlayer(ludo.register[x]):SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message2.."|R")
- GetPlayer(ludo.register[x]):PlaySoundToPlayer(STARTSOUND)
- end
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message1.."|R")
- end
- end
- if(id==2)then
- plr:GossipComplete()
- for k,v in pairs(ludo.register)do
- if(v==plr:GetName())then
- ludo.register[k] = nil
- break;
- end
- end
- end
- if(id==3)then
- plr:GossipComplete()
- if(ludo.game.diced~=true)then
- local s = true
- ludo.game.diced = true
- ludo.game.numb = math.random(6)
- ludo.sendmessages(string.gsub(string.gsub(message8, "NAME", ludo.game.plrs[ludo.game.round][2]), "NUMBER", ludo.game.numb))
- for k,v in pairs(ludo.game.figurespawns[ludo.game.plrs[ludo.game.round][3]])do
- if(v[5]==true)then
- s = false
- break
- end
- end
- if(s==true)then
- if(ludo.game.numb<6)then
- ludo.game.diced = false
- ludo.game.maxplays = ludo.game.maxplays-1
- ludo.sendmessages(string.gsub(string.gsub(message12, "NAME", ludo.game.plrs[ludo.game.round][2]), "NUMBER", ludo.game.maxplays))
- if(ludo.game.maxplays==0)and(ludo.game.numb~=6)then
- ludo.change_player()
- end
- end
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message7.."|R")
- end
- end
- if(id==4)then
- plr:GossipComplete()
- ludo.change_player()
- end
- if(id==5)then
- plr:GossipComplete()
- for k,v in pairs(ludo.game.plrs)do
- if(v[2]==plr:GetName())then
- ludo.removeplayer(ludo.game.plrs[k])
- end
- end
- end
- if(id==99)then
- plr:GossipComplete()
- end
- end
- RegisterUnitGossipEvent(NPCID_LUDO,1,"LudoNPC_Gossip")
- RegisterUnitGossipEvent(NPCID_LUDO,2,"LudoNPC_Select")
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- -------------------------------Game Start------------------------------
- function LUDO_commands(_, plr, msg)
- if(msg==rdymsg)then
- if(ludo.game.rdy)then
- if(ludo.game.rdys[plr:GetName()]~=true)then
- ludo.game.rdys[plr:GetName()] = true
- if(LSA.tabget(ludo.game.rdys)>=PLAYERMAX)then
- ludo.create_game()
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message3.."|R")
- end
- end
- end
- end
- --[[if(msg:find("#command ")==1)then --CHEATCODE
- if(ludo.game.diced~=true)then
- local s = true
- ludo.game.diced = true
- local numbii = msg:gsub("#wurf ", "")
- ludo.game.numb = tonumber(numbii)
- ludo.sendmessages(string.gsub(string.gsub(message8, "NAME", ludo.game.plrs[ludo.game.round][2]), "NUMBER", ludo.game.numb))
- for k,v in pairs(ludo.game.figurespawns[ludo.game.plrs[ludo.game.round][3]REMOVETHISTEXT])do
- if(v[5]==true)then
- s = false
- break
- end
- end
- if(s==true)then
- if(ludo.game.numb<6)then
- ludo.game.diced = false
- ludo.game.maxplays = ludo.game.maxplays-1
- ludo.sendmessages(string.gsub(string.gsub(message12, "NAME", ludo.game.plrs[ludo.game.round][2]), "NUMBER", ludo.game.maxplays))
- if(ludo.game.maxplays==0)and(ludo.game.numb~=6)then
- ludo.change_player()
- end
- end
- end
- end
- end ]]
- end
- RegisterServerHook(16, "LUDO_commands")
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- -------------------------------Game Create------------------------------
- function ludo.create_game()
- ludo.game.plrs = {}
- for x=1,PLAYERMAX,1 do
- ludo.game.plrs[x] = {}
- ludo.game.plrs[x][1] = GetPlayer(ludo.register[x])
- ludo.game.plrs[x][2] = ludo.register[x]
- ludo.game.plrs[x][3] = ludo.randomgenerator(x)
- end
- ludo.sendmessages(message4)
- ludo.game.gametyp = "rdy"
- ludo.game.maxplays = 3
- ludo.game.winnerplace = 1
- ludo.game.spawns = {}
- ludo.register = {}
- ludo.game.round = math.random(table.getn(ludo.game.plrs))
- ludo.game.field = {}
- ludo.game.starts = {}
- ludo.game.figurespawns = {["yellow"] = {}, ["red"] = {}, ["green"] = {}, ["blue"] = {} }
- ludo.game.figurewins = {["yellow"] = {}, ["red"] = {}, ["green"] = {}, ["blue"] = {} }
- for x=1,PLAYERMAX,1 do
- ludo.game.plrs[x][1]:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..string.gsub(string.gsub(message6, "NAME", ludo.game.plrs[ludo.game.round][2]), "COLOR", ludo.get_color(ludo.game.plrs[x][3])).."|R")
- end
- ludo.game.figures = {}
- for k,v in pairs(gamefield)do
- table.insert(ludo.game.spawns, ludo.game.unt:SpawnGameObject(v[1], ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], v[5], 0, v[6]*100, 1))
- if(v[7]=="field")then
- local tab = {false, ludo.game.x+v[2],ludo.game.y+v[3],ludo.game.z+v[4], false}
- table.insert(ludo.game.field, tab)
- end
- if(v[7]=="startyellow")then
- ludo.game.starts["yellow"] = {ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4]}
- local tab = {false, ludo.game.x+v[2],ludo.game.y+v[3],ludo.game.z+v[4], true}
- table.insert(ludo.game.field, tab)
- elseif(v[7]=="startred")then
- ludo.game.starts["red"] = {ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4]}
- local tab = {false, ludo.game.x+v[2],ludo.game.y+v[3],ludo.game.z+v[4], true}
- table.insert(ludo.game.field, tab)
- elseif(v[7]=="startgreen")then
- ludo.game.starts["green"] = {ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4]}
- local tab = {false, ludo.game.x+v[2],ludo.game.y+v[3],ludo.game.z+v[4], true}
- table.insert(ludo.game.field, tab)
- elseif(v[7]=="startblue")then
- ludo.game.starts["blue"] = {ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4]}
- local tab = {false, ludo.game.x+v[2],ludo.game.y+v[3],ludo.game.z+v[4], true}
- table.insert(ludo.game.field, tab)
- end
- if(v[7]=="spawnyellow")then
- local unit = ludo.game.unt:SpawnCreature(COLOR_YELLOW_NPC, ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], 0, 35, 0,0,0,0,1)
- ludo.game.figurespawns["yellow"][tostring(unit)] = {unit, ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], false}
- table.insert(ludo.game.spawns, unit)
- elseif(v[7]=="spawnred")then
- local unit = ludo.game.unt:SpawnCreature(COLOR_RED_NPC, ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], 0, 35, 0,0,0,0,1)
- ludo.game.figurespawns["red"][tostring(unit)] = {unit, ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], false}
- table.insert(ludo.game.spawns, unit)
- elseif(v[7]=="spawngreen")then
- local unit = ludo.game.unt:SpawnCreature(COLOR_GREEN_NPC, ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], 0, 35, 0,0,0,0,1)
- ludo.game.figurespawns["green"][tostring(unit)] = {unit, ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], false}
- table.insert(ludo.game.spawns, unit)
- elseif(v[7]=="spawnblue")then
- local unit = ludo.game.unt:SpawnCreature(COLOR_BLUE_NPC, ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], 0, 35, 0,0,0,0,1)
- ludo.game.figurespawns["blue"][tostring(unit)] = {unit, ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], false}
- table.insert(ludo.game.spawns, unit)
- end
- if(v[7]=="winblue")then
- local tab = {ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], false}
- table.insert(ludo.game.figurewins["blue"], tab)
- elseif(v[7]=="winred")then
- local tab = {ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], false}
- table.insert(ludo.game.figurewins["red"], tab)
- elseif(v[7]=="wingreen")then
- local tab = {ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], false}
- table.insert(ludo.game.figurewins["green"], tab)
- elseif(v[7]=="winyellow")then
- local tab = {ludo.game.x+v[2], ludo.game.y+v[3], ludo.game.z+v[4], false}
- table.insert(ludo.game.figurewins["yellow"], tab)
- end
- end
- end
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- --------------------------------functions-------------------------------
- function ludo.sendmessages(msg)
- if(ludo.game.plrs[1]~=nil)then
- ludo.game.plrs[1][1]:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..msg.."|R")
- end
- if(ludo.game.plrs[2]~=nil)then
- ludo.game.plrs[2][1]:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..msg.."|R")
- end
- if(ludo.game.plrs[3]~=nil)then
- ludo.game.plrs[3][1]:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..msg.."|R")
- end
- if(ludo.game.plrs[4]~=nil)then
- ludo.game.plrs[4][1]:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..msg.."|R")
- end
- end
- local rndgenerate = false
- function ludo.randomgenerator(x)
- if(x==1)then
- local tab = {
- {"green","red","blue","yellow"},
- {"red","blue","yellow","green"},
- {"blue","yellow","green","red"},
- {"yellow","green","red","blue"}
- }
- rndgenerate = tab[math.random(table.getn(tab))]
- end
- return rndgenerate[x];
- end
- function ludo.change_player()
- if(ludo.game.round<table.getn(ludo.game.plrs))then
- ludo.game.round = ludo.game.round+1
- else
- ludo.game.round = 1
- end
- if(ludo.game.plrs[ludo.game.round]~=nil)then
- ludo.sendmessages(string.gsub(message5, "NAME", ludo.game.plrs[ludo.game.round][2]))
- end
- ludo.game.diced = false
- ludo.game.maxplays = 3
- end
- function ludo.get_color(color)
- if(color=="green")then return color_green; end
- if(color=="red")then return color_red; end
- if(color=="blue")then return color_blue; end
- if(color=="yellow")then return color_yellow; end
- end
- function ludo.throw(tab)
- ludo.game.figurespawns[tab[2]][tab[1]][1]:TeleportCreature(ludo.game.figurespawns[tab[2]][tab[1]][2], ludo.game.figurespawns[tab[2]][tab[1]][3], ludo.game.figurespawns[tab[2]][tab[1]][4])
- ludo.game.figurespawns[tab[2]][tab[1]][5] = false
- end
- function ludo.wincontroll(typ)
- local win = true
- for k,v in pairs(ludo.game.figurewins[typ])do
- if(v[4]==false)then
- win = false
- break
- end
- end
- if(win==true)then
- ludo.playerwin(ludo.game.plrs[ludo.game.round])
- return true;
- end
- end
- function ludo.playerwin(plrtab)
- if(ludo.game.winnerplace==1)then
- for k,v in pairs(wintab)do
- plrtab[1]:AddItem(v[1], v[2])
- end
- end
- ludo.sendmessages(string.gsub(string.gsub(message13, "NAME", plrtab[2]), "NUMBER", ludo.game.winnerplace))
- ludo.game.winnerplace = ludo.game.winnerplace+1
- ludo.removeplayer(plrtab, "win")
- end
- function ludo.removeplayer(plrtab, wl)
- if(table.getn(ludo.game.plrs)>2)then
- ludo.sendmessages(string.gsub(message14, "NAME", plrtab[2]))
- for k,v in pairs(ludo.game.plrs)do
- if(v[2]==plrtab[2])then
- table.remove(ludo.game.plrs, k)
- ludo.change_player()
- end
- end
- else
- if(wl~="win")then
- ludo.sendmessages(string.gsub(message15, "NAME", plrtab[2]))
- end
- RegisterTimedEvent("ludo_removegame",2000,1)
- --ludo.removegame()
- end
- end
- function ludo_removegame()
- for k,v in pairs(ludo.game.spawns)do
- if(v:IsInWorld())then
- v:RemoveFromWorld()
- end
- ludo.register = {}
- ludo.game = {}
- rndgenerate = false
- end
- end
- function Logout_Ludo(_, plr)
- if(ludo.game.plr~=nil)then
- for k,v in pairs(ludo.game.plr)do
- if(v[2]==plr:GetName())then
- if(plr:GetName()==ludo.game.plrs[ludo.game.round][2])then
- ludo.change_player()
- end
- ludo.removeplayer(ludo.game.plrs[k])
- end
- end
- end
- for k,v in pairs(ludo.register)do
- if(v==plr:GetName())then
- ludo.register[k] = nil
- if(ludo.game.gametyp=="rdy")then
- ludo.game = {}
- for k,v in pairs(ludo.register)do
- GetPlayer(v):SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message17.."|R")
- end
- end
- end
- end
- end
- RegisterServerHook(13, "Logout_Ludo")
- function ludo.getnewpos(currentpos, newpos)
- if(currentpos+newpos>40)then
- return currentpos-40+newpos
- else
- return currentpos+newpos
- end
- end
- function ludo.movesystem(color, unit, plr)
- if(ludo.game.diced==true)then
- local current = ludo.game.figurespawns[color][unit].pos
- if(ludo.game.figurespawns[color][unit].moves<=40)then
- ludo.game.field[ludo.game.figurespawns[color][unit].pos][1] = false
- else
- ludo.game.figurewins[color][ludo.game.figurespawns[color][unit].moves-40][4] = false
- end
- if(ludo.game.figurespawns[color][unit].moves+ludo.game.numb<=40)then
- local posii = ludo.getnewpos(ludo.game.figurespawns[color][unit].pos, ludo.game.numb)
- local x = 0
- if(ludo.game.field[posii][1]~=false)then
- if(ludo.game.field[posii][1][2]~=color)then
- if(ludo.game.field[posii][5]~=true)then
- ludo.throw(ludo.game.field[posii][1])
- end
- ludo.game.field[posii][1] = {unit, color}
- else
- x = 1
- while(ludo.game.field[posii+x][1]~=false)do
- if(ludo.game.field[posii+x][1][2]~=color)then
- if(ludo.game.field[posii][5]~=true)then
- ludo.throw(ludo.game.field[posii][1])
- end
- ludo.game.field[posii][1] = {unit, color}
- break
- end
- if(posii+x>=40)then
- x = x-40
- else
- x = x+1
- end
- end
- end
- else
- ludo.game.field[posii][1] = {unit, color}
- end
- ludo.game.figurespawns[color][unit].pos = posii+x
- ludo.game.figurespawns[color][unit].moves = ludo.game.figurespawns[color][unit].moves+ludo.game.numb+x
- ludo.moveto(ludo.game.figurespawns[color][unit][1], ludo.game.numb+x, current, ludo.game.figurespawns[color][unit].moves-ludo.game.numb, 0, color)
- if(ludo.game.numb<6)then
- ludo.change_player()
- else
- ludo.game.diced = false
- ludo.sendmessages(string.gsub(message16, "NAME", ludo.game.plrs[ludo.game.round][2]))
- end
- else
- if(ludo.game.figurespawns[color][unit].moves+ludo.game.numb<=44)then
- local posi = ludo.game.figurespawns[color][unit].moves-40+ludo.game.numb
- if(posi<=table.getn(ludo.game.figurewins[color]))then
- if(ludo.game.figurewins[color][posi][4]==false)then
- ludo.game.figurespawns[color][unit].moves = posi+40
- ludo.game.figurespawns[color][unit][5] = "finish"
- ludo.game.figurewins[color][posi][4] = true
- ludo.moveto(ludo.game.figurespawns[color][unit][1], ludo.game.numb, current, ludo.game.figurespawns[color][unit].moves-ludo.game.numb, 1, color)
- if(ludo.wincontroll(ludo.game.plrs[ludo.game.round][3])==true)then
- return;
- end
- if(ludo.game.numb<6)then
- ludo.change_player()
- else
- ludo.game.diced = false
- ludo.sendmessages(string.gsub(message16, "NAME", ludo.game.plrs[ludo.game.round][2]))
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message11.."|R")
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message11.."|R")
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message11.."|R")
- end
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message9.."|R")
- end
- end
- function ludo.moveto(unt, newpos, currentpos, moves, typ, color)
- if(typ==0)then
- if(newpos>1)then
- local movetab = {}
- for x=1,newpos,1 do
- if(currentpos+x<=40)then
- if(x<newpos)then
- movetab[x] = {ludo.game.field[currentpos+x][2],ludo.game.field[currentpos+x][3],ludo.game.field[currentpos+x][4],0,1}
- else
- movetab[x] = {ludo.game.field[currentpos+x][2],ludo.game.field[currentpos+x][3],ludo.game.field[currentpos+x][4],0,false}
- end
- else
- if(x<newpos)then
- movetab[x] = {ludo.game.field[currentpos+x-40][2],ludo.game.field[currentpos+x-40][3],ludo.game.field[currentpos+x-40][4],0,1}
- else
- movetab[x] = {ludo.game.field[currentpos+x-40][2],ludo.game.field[currentpos+x-40][3],ludo.game.field[currentpos+x-40][4],0,false}
- end
- end
- end
- MP.StartPath(unt, movetab)
- else
- if(currentpos+1<=40)then
- unt:MoveTo(ludo.game.field[currentpos+1][2],ludo.game.field[currentpos+1][3],ludo.game.field[currentpos+1][4])
- else
- unt:MoveTo(ludo.game.field[1][2],ludo.game.field[1][3],ludo.game.field[1][4])
- end
- end
- end
- if(typ==1)then
- if(newpos>1)then
- local movetab = {}
- for x=1,newpos,1 do
- if(moves+x<=40)then
- if(x<newpos)then
- movetab[x] = {ludo.game.field[currentpos+x][2],ludo.game.field[currentpos+x][3],ludo.game.field[currentpos+x][4],0,1}
- else
- movetab[x] = {ludo.game.field[currentpos+x][2],ludo.game.field[currentpos+x][3],ludo.game.field[currentpos+x][4],0,false}
- end
- else
- if(x<newpos)then
- movetab[x] = {ludo.game.figurewins[color][moves+x-40][1],ludo.game.figurewins[color][moves+x-40][2],ludo.game.figurewins[color][moves+x-40][3],0,1}
- else
- movetab[x] = {ludo.game.figurewins[color][moves+x-40][1],ludo.game.figurewins[color][moves+x-40][2],ludo.game.figurewins[color][moves+x-40][3],0,false}
- end
- end
- end
- MP.StartPath(unt, movetab)
- else
- unt:MoveTo(ludo.game.figurewins[color][moves+1-40][1],ludo.game.figurewins[color][moves+1-40][2],ludo.game.figurewins[color][moves+1-40][3])
- end
- end
- end
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- -------------------------------Gamefigures------------------------------
- function LudoBLUE_NPC_Gossip(unt, _, plr)
- if(plr:GetName()==ludo.game.plrs[ludo.game.round][2])and(ludo.game.plrs[ludo.game.round][3]=="blue")then
- unt:GossipCreateMenu(1, plr, 0)
- if(ludo.game.figurespawns["blue"][tostring(unt)][5]==true)or(ludo.game.figurespawns["blue"][tostring(unt)][5]=="finish")then
- unt:GossipMenuAddItem(7,menu4, 1, 0)
- elseif(ludo.game.figurespawns["blue"][tostring(unt)][5]==false)then
- unt:GossipMenuAddItem(7,menu6, 2, 0)
- end
- unt:GossipMenuAddItem(7,"["..menu3.."]", 99, 0)
- unt:GossipSendMenu(plr)
- end
- end
- function LudoBLUE_NPC_Select(unt, _, plr, _, id, code)
- if(id==1)then
- plr:GossipComplete()
- ludo.movesystem("blue", tostring(unt), plr)
- end
- if(id==2)then
- plr:GossipComplete()
- if(ludo.game.diced==true)then
- if(ludo.game.numb==6)then
- ludo.game.figurespawns["blue"][tostring(unt)][5]=true
- unt:TeleportCreature(ludo.game.starts["blue"][1], ludo.game.starts["blue"][2], ludo.game.starts["blue"][3])
- ludo.game.figurespawns["blue"][tostring(unt)].pos = 1
- ludo.game.figurespawns["blue"][tostring(unt)].moves = 1
- ludo.game.diced = false
- ludo.sendmessages(string.gsub(message16, "NAME", ludo.game.plrs[ludo.game.round][2]))
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message10.."|R")
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message9.."|R")
- end
- end
- if(id==99)then
- plr:GossipComplete()
- end
- end
- RegisterUnitGossipEvent(COLOR_BLUE_NPC,1,"LudoBLUE_NPC_Gossip")
- RegisterUnitGossipEvent(COLOR_BLUE_NPC,2,"LudoBLUE_NPC_Select")
- function LudoRED_NPC_Gossip(unt, _, plr)
- if(plr:GetName()==ludo.game.plrs[ludo.game.round][2])and(ludo.game.plrs[ludo.game.round][3]=="red")then
- unt:GossipCreateMenu(1, plr, 0)
- if(ludo.game.figurespawns["red"][tostring(unt)][5]==true)or(ludo.game.figurespawns["red"][tostring(unt)][5]=="finish")then
- unt:GossipMenuAddItem(7,menu4, 1, 0)
- elseif(ludo.game.figurespawns["red"][tostring(unt)][5]==false)then
- unt:GossipMenuAddItem(7,menu6, 2, 0)
- end
- unt:GossipMenuAddItem(7,"["..menu3.."]", 99, 0)
- unt:GossipSendMenu(plr)
- end
- end
- function LudoRED_NPC_Select(unt, _, plr, _, id, code)
- if(id==1)then
- plr:GossipComplete()
- ludo.movesystem("red", tostring(unt), plr)
- end
- if(id==2)then
- plr:GossipComplete()
- if(ludo.game.diced==true)then
- if(ludo.game.numb==6)then
- ludo.game.figurespawns["red"][tostring(unt)][5]=true
- unt:TeleportCreature(ludo.game.starts["red"][1], ludo.game.starts["red"][2], ludo.game.starts["red"][3])
- ludo.game.figurespawns["red"][tostring(unt)].pos = 31
- ludo.game.figurespawns["red"][tostring(unt)].moves = 1
- ludo.game.diced = false
- ludo.sendmessages(string.gsub(message16, "NAME", ludo.game.plrs[ludo.game.round][2]))
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message10.."|R")
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message9.."|R")
- end
- end
- if(id==99)then
- plr:GossipComplete()
- end
- end
- RegisterUnitGossipEvent(COLOR_RED_NPC,1,"LudoRED_NPC_Gossip")
- RegisterUnitGossipEvent(COLOR_RED_NPC,2,"LudoRED_NPC_Select")
- function LudoGREEN_NPC_Gossip(unt, _, plr)
- if(plr:GetName()==ludo.game.plrs[ludo.game.round][2])and(ludo.game.plrs[ludo.game.round][3]=="green")then
- unt:GossipCreateMenu(1, plr, 0)
- if(ludo.game.figurespawns["green"][tostring(unt)][5]==true)or(ludo.game.figurespawns["green"][tostring(unt)][5]=="finish")then
- unt:GossipMenuAddItem(7,menu4, 1, 0)
- elseif(ludo.game.figurespawns["green"][tostring(unt)][5]==false)then
- unt:GossipMenuAddItem(7,menu6, 2, 0)
- end
- unt:GossipMenuAddItem(7,"["..menu3.."]", 99, 0)
- unt:GossipSendMenu(plr)
- end
- end
- function LudoGREEN_NPC_Select(unt, _, plr, _, id, code)
- if(id==1)then
- plr:GossipComplete()
- ludo.movesystem("green", tostring(unt), plr)
- end
- if(id==2)then
- plr:GossipComplete()
- if(ludo.game.diced==true)then
- if(ludo.game.numb==6)then
- ludo.game.figurespawns["green"][tostring(unt)][5]=true
- unt:TeleportCreature(ludo.game.starts["green"][1], ludo.game.starts["green"][2], ludo.game.starts["green"][3])
- ludo.game.figurespawns["green"][tostring(unt)].pos = 21
- ludo.game.figurespawns["green"][tostring(unt)].moves = 1
- ludo.game.diced = false
- ludo.sendmessages(string.gsub(message16, "NAME", ludo.game.plrs[ludo.game.round][2]))
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message10.."|R")
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message9.."|R")
- end
- end
- if(id==99)then
- plr:GossipComplete()
- end
- end
- RegisterUnitGossipEvent(COLOR_GREEN_NPC,1,"LudoGREEN_NPC_Gossip")
- RegisterUnitGossipEvent(COLOR_GREEN_NPC,2,"LudoGREEN_NPC_Select")
- function LudoYELLOW_NPC_Gossip(unt, _, plr)
- if(plr:GetName()==ludo.game.plrs[ludo.game.round][2])and(ludo.game.plrs[ludo.game.round][3]=="yellow")then
- unt:GossipCreateMenu(1, plr, 0)
- if(ludo.game.figurespawns["yellow"][tostring(unt)][5]==true)or(ludo.game.figurespawns["yellow"][tostring(unt)][5]=="finish")then
- unt:GossipMenuAddItem(7,menu4, 1, 0)
- elseif(ludo.game.figurespawns["yellow"][tostring(unt)][5]==false)then
- unt:GossipMenuAddItem(7,menu6, 2, 0)
- end
- unt:GossipMenuAddItem(7,"["..menu3.."]", 99, 0)
- unt:GossipSendMenu(plr)
- end
- end
- function LudoYELLOW_NPC_Select(unt, _, plr, _, id, code)
- if(id==1)then
- plr:GossipComplete()
- ludo.movesystem("yellow", tostring(unt), plr)
- end
- if(id==2)then
- plr:GossipComplete()
- if(ludo.game.diced==true)then
- if(ludo.game.numb==6)then
- ludo.game.figurespawns["yellow"][tostring(unt)][5]=true
- unt:TeleportCreature(ludo.game.starts["yellow"][1], ludo.game.starts["yellow"][2], ludo.game.starts["yellow"][3])
- ludo.game.figurespawns["yellow"][tostring(unt)].pos = 11
- ludo.game.figurespawns["yellow"][tostring(unt)].moves = 1
- ludo.game.diced = false
- ludo.sendmessages(string.gsub(message16, "NAME", ludo.game.plrs[ludo.game.round][2]))
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message10.."|R")
- end
- else
- plr:SendBroadcastMessage("|CFFFF0000["..mainnpcname.."]: |R|CFFFFFFFF"..message9.."|R")
- end
- end
- if(id==99)then
- plr:GossipComplete()
- end
- end
- RegisterUnitGossipEvent(COLOR_YELLOW_NPC,1,"LudoYELLOW_NPC_Gossip")
- RegisterUnitGossipEvent(COLOR_YELLOW_NPC,2,"LudoYELLOW_NPC_Select")
- ------------------------------------------------------------------------
- ------------------------------------------------------------------------
- print("Ludo successfully loaded")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement