×

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
  • /
  • TFM Shaman Tutorial
TFM Shaman Tutorial
Klipus
« Citoyen »
1772254680000
    • Klipus#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  1
TFM Shaman Tutorial is a small Lua minigame, which is a step-by-step tutorial about using planks with nails as a shaman in Transformice. Shaman receives a detailed instructions on the each stage of tutorial and a valuable hints for a future.

In addition, when shaman have to summon a plank in a certain place, this place is marked with a brown line and script proceeds to a next stage only, when a plank will be summoned at a place with the predefined coordinates (with some tolerance, of course).

Unfortunately, a Lua script has no possibility to detect, that summoned plank has a nails, so this script naively believes that a player placed a plank with a nail.

Check out this video to see, how that minigame works:


There is no need to change anything in source code to run it. Just copy-paste it to a /lua window and start it in your tribe house.
Source code
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
-- TFM Shaman Tutorial by Klipus#0000 (C) 2025-2026
--
-- A small Lua minigame with a basic shaman tutorial on using planks with nails
--


-- Variables
build_stage = 0
groundid_for_joints = 321
_plank1_x0 = 335
_plank1_y0 = 345
_plank1_angle = 0
_plank2_x0 = 440
_plank2_y0 = 250
_plank2_angle = 280
_plank2_x00 = 420
_plank2_x01 = 470
_plank2_y00 = 340
_plank2_y01 = 160
popup_x = 0
popup_y = 30
popup_w = 350
popup_h = 0

-- UI messages
message_map_name = "<B>TFM Shaman Tutorial</B> by <V>Klipus#0000</V>"

message_toolbox = "<R><a href='event:giveup' >[Give up current round]</a></R>"

message_stage1shaman = "<p align='center' ><J>Now, it's time to practice as a shaman!</J><br><br>" ..
"On the right-lower side of the interface, there is a list with items that you can create on a map.<br><br>" ..
"Select one item from a list, for example a <PT>plank</PT> and click a button below to proceed.<br><br>" ..
"<a href='event:tutorialPopup_stage2' ><font size='16' ><b>[OK, I did it]</b></font></a></p>"

message_stage1mouse = "<p align='center' ><J>You are a little mouse now!</J><br><br>" ..
"Currently, there is a shaman turn of another player.<br><br>" ..
"<a href='event:tutorialPopup_stage2a' ><font size='16' ><b>[OK, I understand]</b></font></a></p>"

message_stage2 = "<p align='center' >To summon an shaman item on the map, select it from a list and <u>long-press</u> <VP>left mouse button</VP> in place, you want to create that item.<br><br>" ..
"<O>NOTE: you can only summon items within a range determined by a circle around you!</O><br><br>" ..
"<a href='event:tutorialPopup_stage3' ><font size='16' ><b>[OK, I understand]</b></font></a></p>"

message_stage4 = "<p align='center' ><J>Good job! You have successfully summoned an object on a map!</J><br><br>" ..
"But there is a problem! That object can be moved freely and can be easily thrown off the map!<br><br>" ..
"Click a button below for a further hints...<br><br>" ..
"<a href='event:tutorialPopup_stage5' ><font size='16' ><b>[OK, let's move on]</b></font></a></p>"

message_stage5 = "<p align='center' >Now, select a <PT>long plank</PT> from list, but before you will long-press a mouse button, <b><u>press a <VP>B</VP> key on your keyboard</u></b>. This will add a <R>red nail</R> to a <PT>long plank</PT> to stabilize it.<br><br>" ..
"Summon that plank in the same place, where you can see a brown line, that appeared now.<br><br>" ..
"<b>Also, remember: DO NOT PUT a planks <u>IN</u> the ground</u>, because this can lead to a collapse of your shaman building! Always put a planks <u>ON</u> the ground!<br><br></b>" ..
"<i>HINT: This time you can press <VP>Space</VP> on your keyboard to make a ghost plank, so the mice could go through it.</i><br><br>" ..
"<O>NOTE: you can only summon items within a range determined by a circle around you!</O><br><br>" ..
"<a href='event:tutorialPopup_stage6' ><font size='16' ><b>[OK, I understand]</b></font></a></p>"

message_stage7 = "<p align='center' ><J>Good job! A first plank is here.</J> Now, there is a time for a second plank. Take a <PT>long plank</PT>, but before you will summon it, you will have to do two things:<br>1) Use a <VP>mouse scroll</VP> or <VP>X Z</VP> keys to rotate a <PT>long plank</PT> to the same angle as the brown line<br>2) <b><u>press a <VP>C</VP> key on your keyboard</u></b> for a few times. You can see, that this adds a <J>yellow nail</J> in a various places of the <PT>long plank</PT>. <J>Yellow nail</J> will let you to stick a one plank to another in a stable way.<br><br>" ..
"As previously, summon a second plank in the same place as a brown line. Place for yellow nail is marked with a circle.<br><br>" ..
"<O>NOTE: you can only summon items within a range determined by a circle around you!</O><br><br>" ..
"<a href='event:tutorialPopup_stage8' ><font size='16' ><b>[OK, I understand]</b></font></a></p>"

message_stage9 = "<p align='center' ><J>Good job! A second plank is here.</J> Now, it's time to get <VP>cheese</VP> and bring it back to the <VP>mousehole</VP>.<br><br>" ..
"<a href='event:tutorialPopup_stage10' ><font size='16' ><b>[OK, I understand]</b></font></a></p>"



-- Code

-- Helper function for clearing all shaman objects from a map
function clearAllShamanObjectsFromMap()
-- Copy objects IDs to a temporary list
local _tmp_objectList = {}
for idx, obj in pairs(tfm.get.room.objectList) do
_tmp_objectList[#_tmp_objectList+1] = idx
end

-- Delete all shaman objects from a map
for idx, obj in pairs(_tmp_objectList) do
tfm.exec.removeObject(obj)
end
end



-- Entry point: eventNewGame()
function tutorialPopup_stage1()
for playerName, playerInfo in pairs(tfm.get.room.playerList) do
if tostring(playerInfo.isShaman) == "true" then
-- Set shaman mode to Easy
tfm.exec.setShamanMode(playerName, 0)

ui.addTextArea(100,
message_stage1shaman,
playerName,
popup_x, popup_y,
popup_w, popup_h,
0x324650, 0x324650, 0.8,
true)

-- Toolbox for a current shaman
ui.addTextArea(101,
message_toolbox,
playerName,
0, 375,
0, 0,
0x324650, 0x324650, 0.8,
true)
else
ui.addTextArea(100,
message_stage1mouse,
playerName,
popup_x, popup_y,
popup_w, popup_h,
0x324650, 0x324650, 0.8,
true)

-- Close toolbox if a player had it in the previous round
ui.removeTextArea(101, playerName)
end
end
end

-- Entry point: tutorialPopup_stage1() - shaman
function tutorialPopup_stage2(playerName)
ui.removeTextArea(100, playerName)

ui.addTextArea(100,
message_stage2,
playerName,
popup_x, popup_y,
popup_w, popup_h,
0x324650, 0x324650, 0.8,
true)
end

-- Entry point: tutorialPopup_stage1() - mouse
function tutorialPopup_stage2a(playerName)
ui.removeTextArea(100, playerName)
end

-- Entry point: tutorialPopup_stage2()
function tutorialPopup_stage3(playerName)
ui.removeTextArea(100, playerName)
end

-- Entry point: eventSummoningEnd()
-- Invoked after creation of the training plank
function tutorialPopup_stage4(playerName)
ui.addTextArea(100,
message_stage4,
playerName,
popup_x, popup_y,
popup_w, popup_h,
0x324650, 0x324650, 0.8,
true)
end

-- Entry point: tutorialPopup_stage4()
function tutorialPopup_stage5(playerName)
-- Next building stage
build_stage = 1

-- Clear all shaman objects
clearAllShamanObjectsFromMap()

-- Draw a preferred area for a first plank

-- Long plank
tfm.exec.addJoint(100, groundid_for_joints, groundid_for_joints, {
type = 0,
point1 = string.format("%d,%d", _plank1_x0-100, _plank1_y0),
point2 = string.format("%d,%d", _plank1_x0+100, _plank1_y0),
line = 15,
color = 0x906136,
alpha = 1,
foreground = false
})

-- Red nail
tfm.exec.addJoint(101, groundid_for_joints, groundid_for_joints, {
type = 0,
point1 = string.format("%d,%d", _plank1_x0, _plank1_y0),
point2 = string.format("%d,%d", _plank1_x0+1, _plank1_y0),
line = 15,
color = 0xfe6564,
alpha = 1,
foreground = false
})

ui.addTextArea(100,
message_stage5,
playerName,
popup_x, popup_y,
popup_w, popup_h,
0x324650, 0x324650, 0.8,
true)
end

-- Entry point: tutorialPopup_stage5()
-- Close pop-up
function tutorialPopup_stage6(playerName)
ui.removeTextArea(100, playerName)
end

-- Entry point: eventSummoningEnd()
-- Invoked after creation of the first plank
function tutorialPopup_stage7(playerName)
-- Next building stage
build_stage = 2

-- Remove previous joints
tfm.exec.removeJoint(100)
tfm.exec.removeJoint(101)

-- Draw a preferred area for a second plank

-- Long plank
tfm.exec.addJoint(102, groundid_for_joints, groundid_for_joints, {
type = 0,
point1 = string.format("%d,%d", _plank2_x00, _plank2_y00),
point2 = string.format("%d,%d", _plank2_x01, _plank2_y01),
line = 15,
color = 0x906136,
alpha = 1,
foreground = false
})

-- Yellow nail ring (lower half)
tfm.exec.addJoint(103, groundid_for_joints, groundid_for_joints, {
type = 2,
point1 = string.format("%d,%d", _plank2_x00-10, _plank2_y00),
point2 = string.format("%d,%d", _plank2_x00+10, _plank2_y00),
point3 = string.format("%d,%d", _plank2_x00-5, _plank2_y00+10),
point4 = string.format("%d,%d", _plank2_x00+5, _plank2_y00+10),
line = 5,
color = 0xcfd737,
alpha = 1.0,
foreground = true
})

-- Yellow nail ring (upper half)
tfm.exec.addJoint(104, groundid_for_joints, groundid_for_joints, {
type = 2,
point1 = string.format("%d,%d", _plank2_x00-10, _plank2_y00),
point2 = string.format("%d,%d", _plank2_x00+10, _plank2_y00),
point3 = string.format("%d,%d", _plank2_x00-5, _plank2_y00-10),
point4 = string.format("%d,%d", _plank2_x00+5, _plank2_y00-10),
line = 5,
color = 0xcfd737,
alpha = 1.0,
foreground = true
})

ui.addTextArea(100,
message_stage7,
playerName,
popup_x, popup_y,
popup_w, popup_h,
0x324650, 0x324650, 0.8,
true)
end

-- Entry point: tutorialPopup_stage7()
-- Close pop-up
function tutorialPopup_stage8(playerName)
ui.removeTextArea(100, playerName)
end

-- Entry point: eventSummoningEnd()
-- Invoked after creation of the second plank
function tutorialPopup_stage9(playerName)
-- Next building stage
build_stage = 3

-- Remove previous joints
tfm.exec.removeJoint(102)
-- tfm.exec.removeJoint(103)
-- tfm.exec.removeJoint(104)

-- Remove ground to remove all remaining joints
tfm.exec.removePhysicObject(groundid_for_joints)

ui.addTextArea(100,
message_stage9,
playerName,
popup_x, popup_y,
popup_w, popup_h,
0x324650, 0x324650, 0.8,
true)
end

-- Entry point: tutorialPopup_stage9()
-- Close pop-up
function tutorialPopup_stage10(playerName)
ui.removeTextArea(100, playerName)
end



function eventTextAreaCallback(textAreaId, playerName, eventName)
if textAreaId == 100 then
-- Tutorial for a shaman

if eventName == "tutorialPopup_stage2" then
tutorialPopup_stage2(playerName)
elseif eventName == "tutorialPopup_stage2a" then
tutorialPopup_stage2a(playerName)
elseif eventName == "tutorialPopup_stage3" then
tutorialPopup_stage3(playerName)
elseif eventName == "tutorialPopup_stage5" then
tutorialPopup_stage5(playerName)
elseif eventName == "tutorialPopup_stage6" then
tutorialPopup_stage6(playerName)
elseif eventName == "tutorialPopup_stage8" then
tutorialPopup_stage8(playerName)
elseif eventName == "tutorialPopup_stage10" then
tutorialPopup_stage10(playerName)
end
elseif textAreaId == 101 then
-- Toolbox for a shaman

if eventName == "giveup" then
-- Start a new map
tfm.exec.disableAllShamanSkills(true)
tfm.exec.newGame(0)
end
end
end

function eventSummoningEnd(playerName, objectType, xPosition, yPosition, angle, objectDescription)
-- Detect particular objects on different building stages
if build_stage == 0 then
-- Training plank (any)
if objectDescription.baseType == 3 or objectDescription.baseType == 4 then
tutorialPopup_stage4(playerName)
end
elseif build_stage == 1 then
-- First long plank with red nail
if objectDescription.baseType == 4 then
if xPosition > (_plank1_x0-50) and xPosition < (_plank1_x0+50) then
if yPosition > (_plank1_y0-30) and yPosition < (_plank1_y0+30) then
if (angle <= 360 and angle > (360-_plank1_angle-20)) or (angle >= 0 and angle < (_plank1_angle+20)) then
tutorialPopup_stage7(playerName)
end
end
end
end
elseif build_stage == 2 then
-- Second plank with yellow nail
if objectDescription.baseType == 4 then
if xPosition > (_plank2_x0-50) and xPosition < (_plank2_x0+50) then
if yPosition > (_plank2_y0-30) and yPosition < (_plank2_y0+30) then
if (angle <= 360 and angle > (360-_plank2_angle-20)) or (angle >= 0 and angle < (_plank2_angle+20)) then
tutorialPopup_stage9(playerName)
end
end
end
end
end
end

function eventNewGame()
ui.setMapName(message_map_name)

-- Reset some variables here
build_stage = 0

-- Add our own ground for drawing joints
tfm.exec.addPhysicObject(groundid_for_joints, 0, 0, {type = 14})

-- Start a tutorial
tutorialPopup_stage1()
end

-- Random scores for a players in the room
for playerName, playerInfo in pairs(tfm.get.room.playerList) do
tfm.exec.setPlayerScore(playerName, math.random(0, 30), false)
end

-- Start a new map
tfm.exec.disableAllShamanSkills(true)
tfm.exec.newGame(0)
Sweaxizone
« Citoyen »
1772303400000
    • Sweaxizone#9654
    • Profil
    • Derniers messages
#2
  0
Congrats, funny how shaman things aren't so assisted in-game
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • TFM Shaman Tutorial
© Atelier801 2018

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

Version 1.27