×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Tribus
  • /
  • Marzyciele
  • /
  • Publiczne
  • /
  • [LUA] Snowmatch
[LUA] Snowmatch
Klipus
« Citoyen »
Membre
1776171840000
    • Klipus#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  0
  • LUA
Snowatch to minigra Lua, podobna do znanego wszystkim modułu #deathmatch, ale zamiast kul armatnich, walczymy za pomocą śnieżek.

Autor minigry: Klipus#0000
Data stworzenia minigry: III 2015
Snowatch is a Lua minigame, similar to well known #deathmatch module, but instead a cannonballs, we are fighting with a snowballs.

Minigame author: Klipus#0000
Date of minigame creation: III 2015
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
--  Snowmatch version 10.03.2015 by Klipus (C) 2015

LOCALE = "en"
-- playersNumber = 0
SCRIPT_ADMIN = "Klipus"
isShootingDisabled = true
version = "10.03.2015"
sleep_time = 2*2
sleep_time_1 = 3*2
sleep_time_2 = 4*2
sleep_time_3 = 5*2
sleep_time_4 = 6*2
sleep_time_5 = 5*2
isPlayerCountingActive = true
isNextGameCountdownActive = false
emptyroomalert = false

if LOCALE == "pl" then
header_text = "Snowmatch - zimowa wersja deathmatch autorstwa gracza Klipus"
help_btn_text = "Kliknij"
help_btn_text2 = "aby uzyskać pomoc"
help = "Pomoc"
help_text = "Celem gry jest zlikwidowanie wszystkich przeciwników. Strzelamy strzałką w dół. W zasadzie tak samo jak w oryginalnym deathmatch :)"
next_round_text = "Następna runda zacznie się za 5 sekund..."
winner_text = "Wygrywa gracz "
shooting = "Strzelanie"
down_arrow = "strzałka w dół"
empty_room = "Mniej niż dwóch graczy w pokoju!"
elseif LOCALE == "en" then
header_text = "Snowmatch - winter version of deathmatch by Klipus"
help_btn_text = "Click"
help_btn_text2 = "for help"
help = "Help"
help_text = "The objective of this game is defeat all enemies. Shotting = down arrow. Like in original deathmatch :)"
next_round_text = "Next round in 5 seconds..."
winner_text = "The winner is "
shooting = "Shooting"
down_arrow = "down arrow"
empty_room = "Less than two players in a room!"
end

function WelcomePopup(playerName)
ui.addTextArea(0,"<font face='Verdana' size='20' color='white' ><i>" .. header_text .. "</font>\n<j>" .. help_btn_text .. " <vp>H<j> " .. help_btn_text2 .. "</j>",playerName,150,100,0,0,0x1c3c41,0x1c3c41,1,true)
end

WelcomePopup(playerName)

isPointsDeleted = false
if isPointsDeleted == false then
for playerName in pairs(tfm.get.room.playerList) do
tfm.exec.setPlayerScore(playerName,0,false)
end

isPointsDeleted = true
end

function NewGame()
sleep_time = 3*2
sleep_time_1 = 4*2
sleep_time_2 = 5*2
sleep_time_3 = 6*2
sleep_time_4 = 7*2
sleep_time_5 = 5*2

isPlayerCountingActive = true
isNextGameCountdownActive = false
isShootingDisabled = true
emptyroomalert = false

mapList = {"@1967512","@1997920","@1967362","@1910196","@1826851"}
tfm.exec.disableAutoShaman(true)
tfm.exec.setShaman("")
tfm.exec.newGame(mapList[math.random(#mapList)])
tfm.exec.setUIMapName("Snowmatch")
tfm.exec.setGameTime(120)
tfm.exec.disableAfkDeath(false)
tfm.exec.disableAutoNewGame(false)
tfm.exec.disableAutoScore(true)
tfm.exec.disableAutoTimeLeft(false)
end

NewGame()

-- Disabled due to lags
-- tfm.exec.snow(1000,10)

-- system.disableChatCommandDisplay("stop", true)

function Help(playerName)
ui.addPopup(0,0,"<font size='25'>" .. help .. "</font>\n" .. help_text,playerName,150,150,500,true)
end

function QuickHelpPopup()
ui.addTextArea(7,"<j>" .. shooting .. " - <vp>" .. down_arrow .. " / S" .. " <j>" .. help .. " - <vp>H <n>Snowmatch version " .. version,playerName,0,380,0,0,0x1c3c41,0x1c3c41,0.7,true)
end

function eventNewGame()
QuickHelpPopup()
NewGame()
end

for playerName in pairs(tfm.get.room.playerList) do
QuickHelpPopup()

tfm.exec.bindKeyboard(playerName, 40, false, true)
tfm.exec.bindKeyboard(playerName, 83, false, true)
tfm.exec.bindKeyboard(playerName, 72, false, true)

-- playersNumber = playersNumber + 1
end

function eventNewPlayer(playerName)
WelcomePopup(playerName)

QuickHelpPopup()

tfm.exec.bindKeyboard(playerName, 40, false, true)
tfm.exec.bindKeyboard(playerName, 83, false, true)
tfm.exec.bindKeyboard(playerName, 72, false, true)

-- playersNumber = playersNumber + 1

tfm.exec.setPlayerScore(playerName,0,false)
end

-- function eventChatCommand(playerName, com)
-- if com == "help" then
-- Help(playerName)
-- elseif com == "stop" then
-- if playerName == SCRIPT_ADMIN then
-- system.exit()
-- end
-- end
-- end

function doShot(playerName)
isFacingRight = tfm.get.room.playerList[playerName].isFacingRight
isDead = tfm.get.room.playerList[playerName].isDead
object_x = tfm.get.room.playerList[playerName].x
object_y = tfm.get.room.playerList[playerName].y
object_vx = tfm.get.room.playerList[playerName].vx
object_vy = tfm.get.room.playerList[playerName].vy

if isDead == false then
if isShootingDisabled == false then
if isFacingRight == true then
tfm.exec.addShamanObject(34,object_x+20,object_y,0,object_vx+20,object_vy,false)
elseif isFacingRight == false then
tfm.exec.addShamanObject(34,object_x-20,object_y,180,object_vx-20,object_vy,false)
end
end
end
end

function eventKeyboard(playerName, key)
if key == 40 then
doShot(playerName)
end

if key == 83 then
doShot(playerName)
end

if key == 72 then
Help(playerName)
end
end

function eventLoop()
playersNumber = 0
for playerName in pairs(tfm.get.room.playerList) do
playersNumber = playersNumber + 1
end

if playersNumber ~= 1 and emptyroomalert == true then
ui.removeTextArea(158, nil)
NewGame()
end

if isPlayerCountingActive == true then
alivePlayers = 0
for playerName in pairs(tfm.get.room.playerList) do
if tfm.get.room.playerList[playerName].isDead == false then
alivePlayers = alivePlayers+1
winnerName = playerName
end
end

if alivePlayers == 1 then
if playersNumber ~= 1 then
tfm.exec.disableAutoNewGame(true)
isPlayerCountingActive=false
ui.addTextArea(10,"<font size='25' >" .. winner_text .. "<t>" .. winnerName .. "<n>!</font>\n<font size='15' ><n>" .. next_round_text .. "</n></font>",nil,150,100,0,0,0x1c3c41,0x1c3c41,1,true)
tfm.exec.setPlayerScore(winnerName,1,true)
isNextGameCountdownActive = true
tfm.exec.giveCheese(winnerName)
tfm.exec.playerVictory(winnerName)
elseif playersNumber == 1 then
ui.addTextArea(158,"<font size='25' >" .. empty_room .. "</font>",nil,150,100,0,0,0x1c3c41,0x1c3c41,1,true)
isPlayerCountingActive=false
emptyroomalert = true
end
end
end

sleep_time = sleep_time - 1
if sleep_time == 0 then
ui.removeTextArea(0,nil)
ui.addTextArea(5,"<font size='30' >3</font>",nil,400,200,0,0,0x1c3c41,0x1c3c41,1,true)
end

sleep_time_1 = sleep_time_1 - 1
if sleep_time_1 == 0 then
ui.updateTextArea(5,"<font size='30' >2</font>",nil)
end

sleep_time_2 = sleep_time_2 - 1
if sleep_time_2 == 0 then
ui.updateTextArea(5,"<font size='30' >1</font>",nil)
end

sleep_time_3 = sleep_time_3 - 1
if sleep_time_3 == 0 then
ui.updateTextArea(5,"<font size='30' >Start</font>",nil)
isShootingDisabled = false
end

sleep_time_4 = sleep_time_4 - 1
if sleep_time_4 == 0 then
ui.removeTextArea(5,nil)
end

if isNextGameCountdownActive == true then
sleep_time_5 = sleep_time_5 - 1
if sleep_time_5 == 0 then
ui.removeTextArea(10,nil)
NewGame()
end
end
end
  • Tribus
  • /
  • Marzyciele
  • /
  • Publiczne
  • /
  • [LUA] Snowmatch
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27