×

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 - samouczek szamana
TFM Shaman Tutorial - samouczek szamana
Klipus
« Citoyen »
1772255280000
    • Klipus#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  1
TFM Shaman Tutorial to mała minigra Lua, która jest samouczkiem wyjaśniającym krok po kroku, jak używać desek z gwoździami jako szaman w Transformice. Szaman otrzymuje szczegółowe instrukcje na każdym etapie samouczka i cenne wskazówki na przyszłość.

Dodatkowo, kiedy szaman musi stworzyć deskę w określonym miejscu, to miejsce zostaje oznaczone brązową linią i skrypt przejdzie do następnego etapu samouczka dopiero wtedy, kiedy deska zostanie stworzona w miejscu o określonych współrzędnych (oczywiście z pewną tolerancją).

Niestety, skrypt Lua nie ma możliwości wykrycia, czy stworzona deska posiada gwoździe, więc ten skrypt naiwnie zakłada, że gracz stworzył deskę z gwoździem.

Sprawdź poniższy filmik, aby zobaczyć jak działa minigra (filmik przedstawia wersję w języku angielskim):


Nie ma potrzeby nic zmieniać w kodzie źródłowym, aby go uruchomić. Wystarczy skopiować poniższy kod i wkleić go do okienka /lua i uruchomić go w swojej chatce plemiennej.
Kod źródłowy
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
--
-- Mała minigra Lua stanowiąca samouczek podstaw używania desek z gwoździami jako szaman
--


-- 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> autorstwa <V>Klipus#0000</V>"

message_toolbox = "<R><a href='event:giveup' >[Poddaj się w tej rundzie]</a></R>"

message_stage1shaman = "<p align='center' ><J>Teraz czas poćwiczyć jako szaman!</J><br><br>" ..
"W prawym dolnym rogu interfejsu znajduje się lista przedmiotów, które można utworzyć na mapie.<br><br>" ..
"Wybierz jeden przedmiot z listy, na przykład <PT>deskę</PT> i kliknij przycisk poniżej, aby kontynuować.<br><br>" ..
"<a href='event:tutorialPopup_stage2' ><font size='16' ><b>[OK, zrobione]</b></font></a></p>"

message_stage1mouse = "<p align='center' ><J>Jesteś teraz małą myszką!</J><br><br>" ..
"W tej rundzie inny gracz jest teraz szamanem.<br><br>" ..
"<a href='event:tutorialPopup_stage2a' ><font size='16' ><b>[OK, rozumiem]</b></font></a></p>"

message_stage2 = "<p align='center' >Aby stworzyć przedmiot szamana na mapie, wybierz go z listy i <u>naciśnij i przytrzymaj</u> <VP>lewy przycisk myszy</VP> w miejscu, w którym chcesz stworzyć ten przedmiot.<br><br>" ..
"<O>PAMIĘTAJ: możesz przywoływać przedmioty tylko w obszarze okręgu znajdującego się wokół ciebie!</O><br><br>" ..
"<a href='event:tutorialPopup_stage3' ><font size='16' ><b>[OK, rozumiem]</b></font></a></p>"

message_stage4 = "<p align='center' ><J>Dobra robota! Pomyślnie przywołałeś obiekt na mapę!</J><br><br>" ..
"Ale jest problem! Ten obiekt można swobodnie przesuwać i można go łatwo zrzucić z mapy!<br><br>" ..
"Kliknij przycisk poniżej w celu uzyskania dalszych wskazówek...<br><br>" ..
"<a href='event:tutorialPopup_stage5' ><font size='16' ><b>[OK, przejdźmy dalej]</b></font></a></p>"

message_stage5 = "<p align='center' >Teraz wybierz <PT>długą deskę</PT> z listy, ale zanim naciśniesz i przytrzymasz przycisk myszy, <b><u>naciśnij klawisz <VP>B</VP> na swojej klawiaturze</u></b>. Dzięki temu dodasz <R>czerwony gwóźdź</R> do <PT>długiej deski</PT> w celu jej ustabilizowania.<br><br>" ..
"Przywołaj tą deskę w tym samym miejscu, w którym widzisz brązową linię, która się teraz pojawiła.<br>" ..
"<b>Pamiętaj też o tym: NIE KŁADŹ desek <u>W</u> gruncie</u>, ponieważ może to doprowadzić do zepsucia się twojej budowli szamana! Zawsze kładź deski <u>NA</u> gruncie!<br></b>" ..
"<i>WSKAZÓWKA: Tym razem możesz nacisnąć <VP>Spację</VP> na klawiaturze, aby utworzyć niewidzialną deskę, przez którą myszy mogą przechodzić.</i><br>" ..
"<O>PAMIĘTAJ: możesz przywoływać przedmioty tylko w obszarze okręgu znajdującego się wokół ciebie!</O><br><br>" ..
"<a href='event:tutorialPopup_stage6' ><font size='16' ><b>[OK, rozumiem]</b></font></a></p>"

message_stage7 = "<p align='center' ><J>Dobra robota! Pierwsza deska jest na swoim miejscu.</J> Teraz czas na drugą deskę. Weź <PT>długą deskę</PT>, ale zanim ją przywołasz, będziesz musiał zrobić dwie rzeczy:<br>1) Użyj <VP>rolki przewijania</VP> lub klawiszy <VP>X Z</VP>, aby obrócić <PT>długą deskę</PT> w taki sposób, aby była pod tym samym kątem, co brązowa linia<br>2) <b><u>naciśnij klawisz <VP>C</VP> na swojej klawiaturze</u></b> kilka razy. Możesz zobaczyć, że dodaje to <J>żółty gwóźdź</J> w różnych miejscach <PT>długiej deski</PT>. <J>Żółty gwóźdź</J> pozwoli ci przyczepić jedną deskę do drugiej w stabilny sposób.<br><br>" ..
"Jak poprzednio, przywołaj drugą deskę w tym samym miejscu, co brązowa linia. Miejsce na zółty gwóźdź zaznaczono okręgiem.<br><br>" ..
"<O>PAMIĘTAJ: możesz przywoływać przedmioty tylko w obszarze okręgu znajdującego się wokół ciebie!</O><br><br>" ..
"<a href='event:tutorialPopup_stage8' ><font size='16' ><b>[OK, rozumiem]</b></font></a></p>"

message_stage9 = "<p align='center' ><J>Dobra robota! Druga deska jest na swoim miejscu.</J> Teraz czas zebrać <VP>ser</VP> i przynieść go spowrotem do <VP>mysiej norki</VP>.<br><br>" ..
"<a href='event:tutorialPopup_stage10' ><font size='16' ><b>[OK, rozumiem]</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)


W tym wątku znajduje się polska wersja językowa minigry. Wersja skryptu w języku angielskim znajduje się tutaj.
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • TFM Shaman Tutorial - samouczek szamana
© Atelier801 2018

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

Version 1.27