×

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
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Panda village
Panda village
Klipus
« Citoyen »
1776162780000
    • Klipus#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  3
  • About
  • Credits
  • LUA

https://i.imgur.com/zN7IieG.png


Do you like pandas? If yes, then a Panda village is a perfect place for you! You can forget about being a mouse for a moment and become a cute, rolling panda!

A suggestion Panda lua event from Transformice Discord was an inspiration to create that script.

That small script for a village room allows player to:
  • become a rolling panda
  • become a bamboo
  • change a nick color
  • change a mouse size

There are on-screen buttons available, as well a chat commands. Type !help to get a list of available chat commands.

This script is intended to be launched in a public village rooms by a FunCorp members. but don't worry! You can launch that script in a tribe house too! It will work, only some chat messages won't be displayed.
LUA code author: Klipus#0000
Idea (Discord suggestion): Klaudiakala & Cherubiniiii
Panda & bamboo drawings: Cherubiniiii
Panda emote: Ewentowyznaj#0358
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
-- Panda village (Transformice)
-- Code author: Klipus#0000 (C) 2026

-- Messages
mapName="<b><font color='#ffffff' >Panda</font> <font color='#0000' >village</font></b>"
welcomeMessage="<VP>Welcome to "..mapName.." entertainment room! Type <BL>!help</BL> to see available commands, or use buttons on the top.</VP><br><PT>Module was created by <V>Klipus#0000</V>, panda & bamboo graphics were drawn by <V>Cherubiniiii#0000</V>, panda smiley was drawn by <V>Ewentowyznaj#0358</V>.<br><BL>Press 'P' key for a little suprise.</BL><BR><FC>Have fun! ;)</FC>"

-- Data for all players in the room
playerData={}

-- Images
imagesDB={
bambooBonus={url="19cc9a82f00.png", x=0, y=-5, scaleX=-0.25, scaleY=0.25, angleX=-0.5, angleY=0.5},
sittingPanda={url="19cc9a84672.png", x=0, y=-5, scaleX=0.15, scaleY=0.15, angleX=0.5, angleY=0.5},
rollingPanda={url="19cc9a84672.png", x=0, y=-5, scaleX=0.15, scaleY=0.15, angleX=0.5, angleY=0.5},
mouse={url="1570ab92c4b.png", x=nil, y=nil, scaleX=nil, scaleY=nil, angleX=nil, angleY=nil},
emoji={url="https://i.imgur.com/kr9Qmo5.png", x=0, y=0, scaleX=1.0, scaleY=1.0, angleX=0.5, angleY=1.75},
}

-- Available chat commands
commands={
help="Opens this help window.",
mouse="Reverts a mouse look.",
panda="Changes mouse into a panda.",
bamboo="Changes mouse into a bamboo.",
color="Changes your nick color.",
size="Changes your mouse size.",
}



-- Functions

-- String to table
function str2tbl(str)
t={}
i=1

while true do
--s=string.match(str, "%w+", i)
s=string.match(str, "[^ ]+", i)
t[#t+1]=s
i=string.find(str, " ", i+1)
if i==nil then break end
end

return t
end

-- Initialize player data
function playerDataInit(playerName)
playerData[playerName]={
id=nil,
rot=0,
sign=1,
image="",
playerSize=1.0,
tpTrigger=false,
emoteImgID=nil,
}
end

-- Remove player data
function playerDataRemove(playerName)
playerData[playerName]=nil
end

-- Flying
function fly(playerName)
tfm.exec.movePlayer(playerName,
0, 0, false,
0, -50, false)
end

-- Changing player size
function changePlayerSize(playerName, newSize)
playerSize=tonumber(newSize)
if playerSize then
if playerSize < 0.1 then
playerSize = 0.1
elseif playerSize > 5.0 then
playerSize = 5.0
end

tfm.exec.changePlayerSize(playerName, playerSize)
playerData[playerName].playerSize=playerSize
end
end

-- Change player nick color
function changePlayerNickColor(playerName, color)
if color then
if color == 0 then
tfm.exec.setNameColor(playerName, 0x1000000)
playerData[playerName].playerColor=0x1000000
elseif color > 0 and color < 0x1000000 then
tfm.exec.setNameColor(playerName, color)
playerData[playerName].playerColor=color
end
end
end

-- Custom emote
function playCustomEmote(playerName, playEmote, emoteId)
if emoteId==nil then
_emoteId=imagesDB.emoji
else
_emoteId=emoteId
end

if playerData[playerName] then
-- Remove previous image
if playerData[playerName].emoteImgID then
tfm.exec.removeImage(playerData[playerName].emoteImgID)
playerData[playerName].emoteImgID=nil
end

if playEmote then
local _sign=1
if tfm.get.room.playerList[playerName].isFacingRight then _sign=-1 end
playerData[playerName].emoteImgID=tfm.exec.addImage(_emoteId.url,
"$" .. playerName,
_emoteId.x, _emoteId.y,
nil,
_emoteId.scaleX*_sign, _emoteId.scaleY,
nil, nil,
_emoteId.angleX*_sign, _emoteId.angleY)
tfm.exec.playSound("transformice/son/smiley.mp3", 100, tfm.get.room.playerList[playerName].x, tfm.get.room.playerList[playerName].y, nil)
playerData[playerName].emoteDuration=7
end
end
end

-- Render UI for a player
function renderUI(playerName)
-- Y=28 (top)
-- Y=365 (bottom)

-- Bind mouse and keys for a player
system.bindMouse(playerName, true)
tfm.exec.bindKeyboard(playerName, 17, true, true) -- CTRL=DOWN
tfm.exec.bindKeyboard(playerName, 17, false, true) -- CTRL=UP
tfm.exec.bindKeyboard(playerName, 32, true, true) -- SPACEBAR=DOWN
tfm.exec.bindKeyboard(playerName, 80, true, true) -- P=DOWN

ui.addTextArea(1,
"<font size='20' ><a href='event:mouse' ><b>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; MOUSE</b></a></font>",
playerName,
0, 28,
150, 0,
0x324650, 0x324650,
0.5, true)

tfm.exec.addImage(imagesDB.mouse.url,
"~0",
5, 25,
playerName,
0.7, 0.7)

ui.addTextArea(2,
"<font size='20' ><a href='event:panda' ><b>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; PANDA</b></a></font>",
playerName,
160, 28,
150, 0,
0x324650, 0x324650,
0.5, true)

tfm.exec.addImage(imagesDB.rollingPanda.url,
"~0",
165, 28,
playerName,
0.1, 0.1)

ui.addTextArea(3,
"<font size='20' ><a href='event:bamboo' ><b>&#xa0;&#xa0;&#xa0;&#xa0;&#xa0; BAMBOO</b></a></font>",
playerName,
320, 28,
150, 0,
0x324650, 0x324650,
0.5, true)

tfm.exec.addImage(imagesDB.bambooBonus.url,
"~0",
325, 30,
playerName,
0.15, 0.15)

ui.addTextArea(4,
"<font size='20' ><a href='event:color' ><b>NICK COLOR</b></a></font>",
playerName,
480, 28,
150, 0,
0x324650, 0x324650,
0.5, true)

ui.addTextArea(5,
"<font size='20' ><a href='event:size' ><b>MOUSE SIZE</b></a></font>",
playerName,
640, 28,
150, 0,
0x324650, 0x324650,
0.5, true)
end

-- Command processing
function moduleCommand(playerName, _commandLine)
commandLine=str2tbl(_commandLine)
command=commandLine[1]

if command=="help" then
local commandsHelp=""
for commandName, commandDesc in pairs(commands) do
commandsHelp=commandsHelp..string.format("!%s - %s<BR>", commandName, commandDesc)
end

ui.addPopup(0, 0, "Available commands:<BR>"..commandsHelp.."<BR>Flying - press a Spacebar<BR>Teleporting - press CTRL and click anywhere on a map<BR>Panda emote - press P", playerName, 250, 100, 300, true)
elseif command=="mouse" then
-- To avoid spammimg with bubbles
if playerData[playerName].image~="" or playerData[playerName].playerSize~=1.0 then
playerData[playerName].image=""

-- Restore player size
tfm.exec.changePlayerSize(playerName, 1.0)
playerData[playerName].playerSize=1.0

-- Respawn player in the same place
local x=tfm.get.room.playerList[playerName].x
local y=tfm.get.room.playerList[playerName].y
tfm.exec.killPlayer(playerName)
tfm.exec.respawnPlayer(playerName)
tfm.exec.movePlayer(playerName, x, y)
end
elseif command=="panda" then
playerData[playerName].image="rollingPanda"
elseif command=="bamboo" then
playerData[playerName].image="bambooBonus"
elseif command=="color" then
tfm.exec.chatMessage("<J>Ask a <FC>FunCorp</FC> member for a nick color visible in chat!</J>", playerName)
if commandLine[2] then
changePlayerNickColor(playerName, tonumber(commandLine[2], 16))
else
ui.showColorPicker(0, playerName, 0x009D9D, "Select a color for nickname above mouse")
end
elseif command=="size" then
if commandLine[2] then
changePlayerSize(playerName, commandLine[2])
else
ui.addPopup(0, 2, "Enter a new player size (in range 0.1-5.0):", playerName, 325, 150, 150, true)
end
end
end



-- Callbacks

function eventNewPlayer(playerName)
ui.setMapName(mapName)
tfm.exec.chatMessage(welcomeMessage, playerName)

playerDataInit(playerName)
renderUI(playerName)
end

function eventPlayerLeft(playerName)
playerDataRemove(playerName)
end

function eventPlayerRespawn(playerName)
if playerData[playerName] and playerData[playerName].playerColor then
tfm.exec.setNameColor(playerName, playerData[playerName].playerColor)
end
end

function eventKeyboard(playerName, keyCode, down)
if keyCode == 17 then
-- CTRL key - teleport
if playerData[playerName] then
playerData[playerName].tpTrigger=down
end
elseif keyCode == 32 then
-- Space - flying
fly(playerName)
elseif keyCode == 80 then -- P
playCustomEmote(playerName, down, nil)
end
end

function eventMouse(playerName, xMousePosition, yMousePosition)
if playerData[playerName] and playerData[playerName].tpTrigger then
tfm.exec.movePlayer(playerName,
xMousePosition, yMousePosition, false,
0, 0, false)
end
end

function eventPopupAnswer(popupId, playerName, answer)
if popupId==0 then
changePlayerSize(playerName, answer)
end
end

function eventColorPicked(colorPickerId, playerName, color)
if colorPickerId==0 then
changePlayerNickColor(playerName, color)
end
end

function eventTextAreaCallback(textAreaId, playerName, eventName)
moduleCommand(playerName, eventName)
end

function eventChatCommand(playerName, command)
moduleCommand(playerName, command)
end

function eventLoop()
for playerName, playerInfo in pairs(tfm.get.room.playerList) do
-- Player with panda or bamboo look
if playerData[playerName] then
-- Flip the image if player is facing left side
if playerInfo.isFacingRight then
playerData[playerName].sign=1
else
playerData[playerName].sign=-1
end

-- Calculate a rotation (panda only)
if playerData[playerName].image=="rollingPanda" then
if playerInfo.movingRight then
playerData[playerName].rot=(playerData[playerName].rot - 5) % 360
playerData[playerName].moving=true
elseif playerInfo.movingLeft then
playerData[playerName].rot=(playerData[playerName].rot + 5) % 360
playerData[playerName].moving=true
else
playerData[playerName].rot=0
playerData[playerName].moving=false
end
else
playerData[playerName].rot=0
playerData[playerName].moving=false
end

-- Remove previous image
if playerData[playerName].id then
tfm.exec.removeImage(playerData[playerName].id)
playerData[playerName].id=nil
end

-- Add a new image
if playerData[playerName].image~="" then
-- Hot-swap panda images (sitting and rolling)
local _image=""
if playerData[playerName].image=="rollingPanda" and playerData[playerName].moving==false then
_image="sittingPanda"
else
_image=playerData[playerName].image
end

-- Add an image and save it's ID
playerData[playerName].id=tfm.exec.addImage(
imagesDB[_image].url,
"%" .. playerName,
imagesDB[_image].x*playerData[playerName].playerSize, imagesDB[_image].y*playerData[playerName].playerSize,
nil,
imagesDB[_image].scaleX*playerData[playerName].sign*playerData[playerName].playerSize, imagesDB[_image].scaleY*playerData[playerName].playerSize,
playerData[playerName].rot, 1,
imagesDB[_image].angleX*playerData[playerName].sign, imagesDB[_image].angleY)
end

-- Emote disappears after 4 seconds
if playerData[playerName].emoteDuration then
if playerData[playerName].emoteDuration == 0 then
playCustomEmote(playerName, nil, nil)
playerData[playerName].emoteDuration=nil
else
playerData[playerName].emoteDuration=playerData[playerName].emoteDuration-1
end
end
end
end
end



-- Map settings
--tfm.exec.disableAfkDeath(true)
--tfm.exec.disableAutoTimeLeft(true)
--tfm.exec.disableAutoNewGame(true)
--tfm.exec.disableAutoShaman(true)
tfm.exec.disablePhysicalConsumables(true)

-- Hide chat commands
for commandName, commandDesc in pairs(commands) do
system.disableChatCommandDisplay(commandName, true)
end

-- Prepare room & player data
ui.setMapName(mapName)
tfm.exec.chatMessage(welcomeMessage)

for playerName, playerInfo in pairs(tfm.get.room.playerList) do
playerDataInit(playerName)
renderUI(playerName)
end
Klaudiakala
« Citoyen »
1776166020000
    • Klaudiakala#8596
    • Profil
    • Derniers messages
    • Tribu
#2
  0
aw, love it
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Panda village
© Atelier801 2018

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

Version 1.27