Advertisement
Guest User

Module Fight - Keltah

a guest
Oct 3rd, 2013
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.87 KB | None | 0 0
  1. tfm.exec.disableAutoNewGame(true)
  2. tfm.exec.disableAutoScore(true)
  3. time = 0
  4. chrononext = 0
  5. invoque = 0
  6. affichemsg = 1
  7. game = 1
  8. deadcham = 0
  9. i = 0
  10. joueurs = {}
  11. shaman = {}
  12. maps = {"44", "48", "49", "50", "51", "52" ,"53", "138", "139", "140", "141", "142", "143", "509145", "2934471", "3665891", "3567033", "3045173", "3384021", "1965497", "2934619", "2952467", "1054567", "1259630", "1470691", "875351", "1437600", "1591172", "1547778", "1547778", "1451150", "1467185", "1444469", "1500085", "1015595", "1439296", "1437755"} -- etc...
  13. tfm.exec.newGame(maps[math.random(#maps)])
  14.  
  15. function eventNewPlayer(playerName)
  16.     ui.addPopup(1,0,"<p align='center'><font color='#BABD2F' size='15'><b>Bienvenue, vous jouez au module « Fight » !</b></font></p><br><p align='justify'><font size='9.5'><b>Le but est simple ! Deux souris sont définies comme les chamans, un compte à rebours commence alors avec une durée de </font><font color='#33CCCC'>« 13 secondes »</font><font size='9.5'> en tant que préparation. Quand le compte à rebours arrive à </font><font color='#33CCCC'>« 0 »</font><font size='9.5'> et que le message </font><font color='#33CCCC'>« FIGHHHHHHHHHHHHT ! »</font><font size='9.5'> apparaît, les deux chamans doivent tenter de s'entre-tuer, mais attention, si un chaman essaye d'invoquer un objet pendant le compte à rebours, il sera éliminé pour ce tour et l'autre chaman gagnera la partie !</b></font></p><br><font color='#FF9900' size='9.5'><b>Pour avoir la liste des commandes tapez : </b></font><b><font size='9.5'>!commandes</font></b><br><br></br><font size='9' color='#C2C2DA'><b>Module codé par Keltah, avec l'aide technique de Varucristal.</b></font></b></font></p>",playerName,150,75,500);
  17. end
  18.  
  19. function eventLoop(temps1,temps2)
  20.     time = time+(1/2)
  21.     nt = 13-time
  22.     if temps2 < 1 then
  23.         tfm.exec.newGame(maps[math.random(#maps)])
  24.     end
  25.     if nt > 5 and nt <= 12.5 and affichemsg == 1 then
  26.         ui.updateTextArea(0, "<p align='center'><font color='#babd2f' face='Arial' size='12.5'><b>Chamanes, vous devez attendre </font><font color='#FF9900' face='Arial' size='12.5'>".. nt .." secondes </font><font color='#babd2f' face='Arial' size='12.5'>avant d'invoquer un objet !</b></font></p>", NIL, 150, 25, 500, 20, 0x1C3C41, 0x1C3C41, 1.2)
  27.         tfm.exec.addShamanObject(0 , 115, 35, -90, 0, 0, false)
  28.         tfm.exec.addShamanObject(0 , 685, 35, 90, 0, 0, false)
  29.     elseif nt <= 5 and nt > 0 and affichemsg == 1 then
  30.         ui.updateTextArea(0, "<p align='center'><font color='#babd2f' face='Arial' size='12.5'><b>Chamanes, vous devez attendre </b></font><p align='center'><font color='#33CCCC' face='Arial' size='12.5'><b>".. nt .." secondes </b></font><p align='center'><font color='#babd2f' face='Arial' size='12.5'><b>avant d'invoquer un objet !</b></font></p>", NIL, 150, 25, 500, 20, 0x1C3C41, 0x1C3C41, 1.2)
  31.     elseif nt == 0 and affichemsg == 1 then
  32.         ui.updateTextArea(0, "<p align='center'><font color='#FF9900' face='Arial' size='12.5'><b>FIGHHHHHHHHHHHHT !</b></font></p>", NIL, 150, 25, 500, 20, 0x1C3C41, 0x1C3C41, 1.2)
  33.     elseif nt == -3 and affichemsg == 1 then
  34.         ui.removeTextArea(0, NIL)
  35.         affichemsg = 0
  36.     end
  37.     if statuscham == 0 then
  38.         ui.removeTextArea(0, NIL)
  39.     end
  40.     if statuscham == 0 and chrononext <= time then
  41.         --ui.updateTextArea(1, chrononext, NIL, 150, 25, 500, 20, 0x1C3C41, 0x1C3C41, 1.2)
  42.     end
  43. end
  44.  
  45. function eventSummoningStart(playerName, objT, x, y, angle)
  46.     if time < 13 and statuscham == 1 and game == 1 then
  47.         tfm.exec.killPlayer(playerName)
  48.         if playerName == shaman[1] then
  49.             ui.addTextArea(1, "<p align='center'><font color='#babd2f' face='Arial' size='12.5'><b>Mince ! Le chaman </font><font color='#FF9900' face='Arial' size='12.5'>".. playerName .."</font><font color='#babd2f' face='Arial' size='12.5'> a voulu invoquer un objet pendant le temps de préparation, il est éliminé !<br> </font><font color='#FF9900' face='Arial' size='12.5'>".. shaman[2] .."</font><font color='#babd2f' face='Arial' size='12.5'> a donc gagné. Va vite sauver tes souris, tu as </font><font color='#FF9900' face='Arial' size='12.5'>1 minute</font><font color='#babd2f' face='Arial' size='12.5'> !</b></font></p>", NIL, 100, 25, 600, 35, 0x1C3C41, 0x1C3C41, 1.2)
  50.             deadchamUn = playerName
  51.             affichemsg = 0
  52.             invoque = 1
  53.             tfm.exec.setGameTime(60)
  54.         elseif playerName == shaman[2] and game == 1 then
  55.             ui.addTextArea(1, "<p align='center'><font color='#babd2f' face='Arial' size='12.5'><b>Mince ! Le chaman </font><font color='#FF9900' face='Arial' size='12.5'>".. playerName .."</font><font color='#babd2f' face='Arial' size='12.5'> a voulu invoquer un objet pendant le temps de préparation, il est éliminé !<br> </font><font color='#FF9900' face='Arial' size='12.5'>".. shaman[1] .."</font><font color='#babd2f' face='Arial' size='12.5'> a donc gagné. Va vite sauver tes souris, tu as </font><font color='#FF9900' face='Arial' size='12.5'>1 minute</font><font color='#babd2f' face='Arial' size='12.5'> !</b></font></p>", NIL, 100, 25, 600, 35, 0x1C3C41, 0x1C3C41, 1.2)
  56.             deadchamUn = playerName
  57.             affichemsg = 0
  58.             invoque = 1
  59.             tfm.exec.setGameTime(60)
  60.         end
  61.     end
  62. end
  63.  
  64. function eventPlayerDied(playerName)
  65.     if tfm.get.room.playerList[playerName].isShaman then
  66.         deadcham = deadcham+1
  67.         statuscham = 0
  68.         chrono = time+(1/2)
  69.         chrononext = 5-chrono
  70.         if game == 0 then
  71.             tfm.exec.setGameTime(20)
  72.         end
  73.         if deadcham == 1 and invoque == 0 and game == 1 then
  74.             if playerName == shaman[1] then
  75.                 ui.addTextArea(1, "<p align='center'><font color='#babd2f' face='Arial' size='12.5'><b>Le chaman </font><font color='#FF9900' face='Arial' size='12.5'>".. playerName .."</font><font color='#babd2f' face='Arial' size='12.5'> est mort ! </font><font color='#FF9900' face='Arial' size='12.5'>".. shaman[2] .."</font><font color='#babd2f' face='Arial' size='12.5'> a gagné. Va vite sauver tes souris, tu as </font><font color='#FF9900' face='Arial' size='12.5'>1 minute</font><font color='#babd2f' face='Arial' size='12.5'> !</b></font></p>", NIL, 125, 25, 550, 20, 0x1C3C41, 0x1C3C41, 1.2)            
  76.                 deadchamUn = playerName
  77.                 affichemsg = 0
  78.                 tfm.exec.setGameTime(60)
  79.             elseif playerName == shaman[2] then
  80.                 ui.addTextArea(1, "<p align='center'><font color='#babd2f' face='Arial' size='12.5'><b>Le chaman </font><font color='#FF9900' face='Arial' size='12.5'>".. playerName .."</font><font color='#babd2f' face='Arial' size='12.5'> est mort ! </font><font color='#FF9900' face='Arial' size='12.5'>".. shaman[1] .."</font><font color='#babd2f' face='Arial' size='12.5'> a gagné. Va vite sauver tes souris, tu as </font><font color='#FF9900' face='Arial' size='12.5'>1 minute</font><font color='#babd2f' face='Arial' size='12.5'> !</b></font></p>", NIL, 125, 25, 550, 20, 0x1C3C41, 0x1C3C41, 1.2)
  81.                 deadchamUn = playerName
  82.                 affichemsg = 0
  83.                 tfm.exec.setGameTime(60)
  84.             end
  85.         elseif deadcham == 2 and game == 1 then
  86.             ui.addTextArea(1, "<p align='center'><font color='#babd2f' face='Arial' size='12.5'><b>Oups les chamanes <font color='#FF9900' face='Arial' size='12.5'>".. deadchamUn .."</font><font color='#babd2f' face='Arial' size='12.5'> et </font><font color='#FF9900' face='Arial' size='12.5'>"..playerName .."</font><font color='#babd2f' face='Arial' size='12.5'> sont mort ! Une autre partie va être lancée.</b></font></p>", NIL, 150, 25, 500, 20, 0x1C3C41, 0x1C3C41, 1.2)
  87.             tfm.exec.setGameTime(10)
  88.             affichemsg = 0
  89.         end
  90.     end
  91. end
  92.        
  93. function eventNewGame()
  94.     ui.removeTextArea(1, NIL)
  95.     joueurs = {}
  96.     shaman = {}
  97.     time = 0
  98.     affichemsg = 1
  99.     statuscham = 1
  100.     chrononext = 0
  101.     deadcham = 0
  102.     invoque = 0
  103.     game = 1
  104.     i = 0
  105.     for name in pairs(tfm.get.room.playerList) do
  106.         i = i+1
  107.         table.insert(joueurs, name)
  108.         if tfm.get.room.playerList[joueurs[i]].isShaman then
  109.             tfm.exec.setPlayerScore(name , 0, false)
  110.             table.insert(shaman, name)
  111.         else
  112.             tfm.exec.setPlayerScore(name , 1, true)
  113.         end
  114.     end
  115.     if i >= 2 and affichemsg == 1 then
  116.         ui.addTextArea(0, "<p align='center'><font color='#babd2f' face='Arial' size='12.5'><b>Chamanes, vous devez attendre </font><font color='#FF9900' face='Arial' size='12.5'>13 secondes </font><font color='#FF9900' face='Arial' size='12.5'> avant d'invoquer un objet !</b></font></p>", NIL, 150, 25, 500, 20, 0x1C3C41, 0x1C3C41, 1.2)
  117.         tfm.exec.addShamanObject(0 , 110, 35, -90, 0, 0, false)
  118.         tfm.exec.addShamanObject(0 , 690, 35, 90, 0, 0, false)
  119.     else
  120.         ui.addTextArea(0, "<p align='center'><font color='#babd2f' face='Arial' size='12.5'><b></font><font color='#FF9900' face='Arial' size='12.5'>Partie annulée</font><font color='#babd2f' face='Arial' size='12.5'>, il n'y a pas assez de souris ! Vous devez être deux souris au minimum.</b></font></p>", NIL, 150, 25, 500, 20, 0x1C3C41, 0x1C3C41, 1.2)
  121.         tfm.exec.addShamanObject(0 , 115, 35, -90, 0, 0, false)
  122.         tfm.exec.addShamanObject(0 , 685, 35, 90, 0, 0, false)
  123.         affichemsg = 2
  124.         game = 0
  125.     end
  126. end
  127.  
  128. for name, player in pairs(tfm.get.room.playerList) do
  129.     eventNewPlayer(name)
  130. end
  131.  
  132. function eventChatCommand(playerName,message)
  133.     if message:sub(0,9) == "commandes" then
  134.         ui.addPopup(2, 0, "<p align='center'><font color='#FF9900' size='10'><b>Voici la liste des commandes :</b></font></p><br><font size='10' color='#babd2f'><b>!regles</b></font><b><font size='10'> : Affiche les règles.</font></b></font><br><font size='10' color='#babd2f'><b>!partie</b></font><b><font size='10'> : Relance une partie.</font></b>", playerName, 0, 100, 200)
  135.     elseif message:sub(0,6) == "partie" then
  136.         tfm.exec.newGame(maps[math.random(#maps)])
  137.     elseif message:sub(0,6) == "regles" then
  138.         ui.addPopup(2,0,"<p align='center'><font color='#BABD2F' size='15'><b>Règles du module « Fight » :</b></font></p><br><p align='justify'><font size='9.5'><b>- Ne pas sauver de souris tant qu'un des deux chamans ne soit pas mort.<br>- Ne pas boucher le trou d'un chaman tant qu'un des deux chamans ne soit pas mort.<br>- Ne pas tuer les souris tant qu'un des deux chamans ne soit pas mort.</b></font></p>",playerName,150,75,500);
  139.     end
  140. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement