×

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
  • /
  • Script Requests
« ‹ 127 / 160 › »
Script Requests
Yami
« Citoyen »
1488844680000
    • Yami#3453
    • Profil
    • Derniers messages
#2521
  0
Velspar a dit :
[Himitsu_no_yami]The easiest method I can think of

ah thanks a lot
Massi
« Consul »
1488987660000
    • Massi#0095
    • Profil
    • Derniers messages
    • Tribu
#2522
  0
I need help who can help me to finish my script please :/
Jordy
« Consul »
1489013100000
    • Jordy#0015
    • Profil
    • Derniers messages
    • Tribu
#2523
  0
Unlocker001 a dit :
I need help who can help me to finish my script please :/

Finish as in write further or as in debugging?
Massi
« Consul »
1489070160000
    • Massi#0095
    • Profil
    • Derniers messages
    • Tribu
#2524
  0
i need rounds rotation team blue and team red
please

Dernière modification le 1489154820000
Azox
« Citoyen »
1489236960000
    • Azox#6250
    • Profil
    • Derniers messages
#2525
  0
i want script if i click on screen
it add PhysicObject in The same place
but we can only add physicObject nerby the mouse
http://i.imgur.com/BDx7gRt.jpg
Rkubi
« Censeur »
1489253040000
    • Rkubi#0000
    • Profil
    • Derniers messages
    • Tribu
#2526
  0
Sodokofo a dit :
i want script if i click on screen
it add PhysicObject in The same place
but we can only add physicObject nerby the mouse
http://i.imgur.com/BDx7gRt.jpg

Code
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  i=0
range = 100 --You can change range in here


function eventNewPlayer(nick)
system.bindMouse(nick,true)
end

function eventMouse(nick,x,y)
local table = {type = 0,width = 100,height = 20}
for n, p in pairs(tfm.get.room.playerList) do
if math.sqrt((p.x - x) ^ 2 + (p.y - y) ^ 2) <= range and n == nick then
tfm.exec.addPhysicObject(i,x + table["width"] / 2,y + table["height"] / 2,table)
i = i + 1
end
end
end

for nick in pairs(tfm.get.room.playerList) do
eventNewPlayer(nick)
end

Dernière modification le 1489316640000
Jordy
« Consul »
1489259940000
    • Jordy#0015
    • Profil
    • Derniers messages
    • Tribu
#2527
  0
Unlocker001 a dit :
i need rounds rotation team blue and team red
please

Can you give more details and info about what exactly you want?
Haytam
« Citoyen »
1489496700000
    • Haytam#0000
    • Profil
    • Derniers messages
    • Tribu
#2528
  0
i make a script snowball war
And i want to make a good shop
so can someone help me please to add shop in game
Massi
« Consul »
1490517780000
    • Massi#0095
    • Profil
    • Derniers messages
    • Tribu
#2529
  0
Hello ^^ can you give me an example how to generate a grounds y=y+60
please
Saintgio
« Consul »
1490537820000
    • Saintgio#0000
    • Profil
    • Derniers messages
    • Tribu
#2530
  0
Unlocker001 a dit :
Hello ^^ can you give me an example how to generate a grounds y=y+60
please

Maybe not the best way

Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
local id = 0

function generateGrounds(y)
for x=0,800,50 do
tfm.exec.addPhysicObject (id, x, y, {type=0,restitution=0.2,friction=0.3,width=10,height=40,groundCollision=true})
id = id + 1
end
end

for y=0,400,60 do
generateGrounds(y)
end
Yami
« Citoyen »
1490643300000
    • Yami#3453
    • Profil
    • Derniers messages
#2531
  0
i have this old Dodge script that used to work but now it keeps erroring and i was hoping someone might be able to help me fix it. It's mostly in some other language too because i couldn't find an english one so i was hoping someone might be able to help me fix it cus i really like this minigame

the error i'm getting is • # [*Manga Anime Society] Init Error : Himitsu_no_yami.lua:4: attempt to call nil

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
 w, mapa= {}, '<C><P/><Z><S><S P="0,0,0.3,0.2,0,0,0,0"L="720"X="400"H="200"Y="480"T="0"/></S><D><DS Y="365"X="400"/></D><O/></Z></C>';

table.foreach({string,math,table,tfm.exec,system,ui}, function(num,libs) for i,v in pairs(libs) do _G= v; end end)
foreach({'AfkDeath','AutoScore','AutoShaman','AutoNewGame','AutoTimeLeft'}, function(n,v) _G['disable'..v](true) end)

eventMessage= function(i)
return g and i or addTextArea(1, eventWinners(), nil,103,21,590,nil,1,1,1) or i;
end

eventNewPlayer= function(p)
w
= bindKeyboard(p,17,true) or bindKeyboard(p,17,false) or w

or 0;
end

eventNewGame= function()
g, tb, cn, tM= false, removeTextArea(1) or {}, setGameTime(180) or false, setMapName(char(35,100,111,100,103,101)) or 0;
end

eventKeyboard= function(p,id,dw)
({t= function() addTextArea(2, eventRanking(), p, 50, 70) end; f= function() removeTextArea(2,p) end})[tostring(dw):sub(0,1)]()
end

eventRanking= function()
local l, txt, r= {}, '<n>%02d. <v>%s<n><j>%s', '<font face="Lucida Console"><r>##. Player Victories\n';
a= foreach(tfm.get.room.playerList, function(i,v) l[#l +1]= {s=w, n=i}; end) or sort(l, function(a,b) return a.s > b.s; end);
return foreach(l, function(i,v) r= i < 11 and r..'\n'..txt:format(i, v.n..(' '):rep(14 -#v.n), v.s) or r; end) or r;
end

eventPlayerDied= function(p)
v= 0; foreach(tfm.get.room.playerList, function(i,p) v= p.isDead == false and v +1 or v; end)
v= v == 1 and eventMessage(v) or v == 0 and eventLoop(0,0);
end

eventLoop= function(a,b)
tM= not tM and 1/2 or tM +1/2;
tM= tM == 175 and eventMessage(tM) or (tM == 180 or b <= 0) and newGame(mapa) or tM;
cn= tM == 5 and true or cn and addShamanObject(17, 801, random(100,375), random(-135,-30)) or cn;
end

eventWinners= function()
str, cn, g= setGameTime(4) or '<j><p align="center"><font face="Lucida Console" size="20">%s: <v>%s', false, true;
foreach(tfm.get.room.playerList, function(p,c) t= not c.isDead; tb[#tb +1], w

= t and p or nil, t and w

+1 or w

; end)
return str:format(char(86,105,99,116,111,114)..(#tb > 1 and char(101,115) or ''), concat(tb, '<j>, <v>')..'<j>!');
end

main= eventLoop(0,0) or foreach(tfm.get.room.playerList, eventNewPlayer);

Dernière modification le 1490643480000
Laagaadoo
« Citoyen »
1490647740000
    • Laagaadoo#0000
    • Profil
    • Derniers messages
    • Tribu
#2532
  0
Himitsu_no_yami a dit :
i have this old Dodge script that used to work but now it keeps erroring and i was hoping someone might be able to help me fix it. It's mostly in some other language too because i couldn't find an english one so i was hoping someone might be able to help me fix it cus i really like this minigame

the error i'm getting is • # [*Manga Anime Society] Init Error : Himitsu_no_yami.lua:4: attempt to call nil

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
 w, mapa= {}, '<C><P/><Z><S><S P="0,0,0.3,0.2,0,0,0,0"L="720"X="400"H="200"Y="480"T="0"/></S><D><DS Y="365"X="400"/></D><O/></Z></C>';

table.foreach({string,math,table,tfm.exec,system,ui}, function(num,libs) for i,v in pairs(libs) do _G= v; end end)
foreach({'AfkDeath','AutoScore','AutoShaman','AutoNewGame','AutoTimeLeft'}, function(n,v) _G['disable'..v](true) end)

eventMessage= function(i)
return g and i or addTextArea(1, eventWinners(), nil,103,21,590,nil,1,1,1) or i;
end

eventNewPlayer= function(p)
w
= bindKeyboard(p,17,true) or bindKeyboard(p,17,false) or w

or 0;
end

eventNewGame= function()
g, tb, cn, tM= false, removeTextArea(1) or {}, setGameTime(180) or false, setMapName(char(35,100,111,100,103,101)) or 0;
end

eventKeyboard= function(p,id,dw)
({t= function() addTextArea(2, eventRanking(), p, 50, 70) end; f= function() removeTextArea(2,p) end})[tostring(dw):sub(0,1)]()
end

eventRanking= function()
local l, txt, r= {}, '<n>%02d. <v>%s<n><j>%s', '<font face="Lucida Console"><r>##. Player Victories\n';
a= foreach(tfm.get.room.playerList, function(i,v) l[#l +1]= {s=w, n=i}; end) or sort(l, function(a,b) return a.s > b.s; end);
return foreach(l, function(i,v) r= i < 11 and r..'\n'..txt:format(i, v.n..(' '):rep(14 -#v.n), v.s) or r; end) or r;
end

eventPlayerDied= function(p)
v= 0; foreach(tfm.get.room.playerList, function(i,p) v= p.isDead == false and v +1 or v; end)
v= v == 1 and eventMessage(v) or v == 0 and eventLoop(0,0);
end

eventLoop= function(a,b)
tM= not tM and 1/2 or tM +1/2;
tM= tM == 175 and eventMessage(tM) or (tM == 180 or b <= 0) and newGame(mapa) or tM;
cn= tM == 5 and true or cn and addShamanObject(17, 801, random(100,375), random(-135,-30)) or cn;
end

eventWinners= function()
str, cn, g= setGameTime(4) or '<j><p align="center"><font face="Lucida Console" size="20">%s: <v>%s', false, true;
foreach(tfm.get.room.playerList, function(p,c) t= not c.isDead; tb[#tb +1], w

= t and p or nil, t and w

+1 or w

; end)
return str:format(char(86,105,99,116,111,114)..(#tb > 1 and char(101,115) or ''), concat(tb, '<j>, <v>')..'<j>!');
end

main= eventLoop(0,0) or foreach(tfm.get.room.playerList, eventNewPlayer);

Try loading the script from this link (Ctrl+A and Ctrl+C).
Sar33aj
« Citoyen »
1490669580000
    • Sar33aj#0000
    • Profil
    • Derniers messages
#2533
  0
make the screen fall apart for everyone in the tribehouse. after 5 seconds its back to normal
Yami
« Citoyen »
1490706540000
    • Yami#3453
    • Profil
    • Derniers messages
#2534
  0
Laagaadoo a dit :
Himitsu_no_yami a dit :
i have this old Dodge script that used to work but now it keeps erroring and i was hoping someone might be able to help me fix it. It's mostly in some other language too because i couldn't find an english one so i was hoping someone might be able to help me fix it cus i really like this minigame

the error i'm getting is • # [*Manga Anime Society] Init Error : Himitsu_no_yami.lua:4: attempt to call nil

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
 w, mapa= {}, '<C><P/><Z><S><S P="0,0,0.3,0.2,0,0,0,0"L="720"X="400"H="200"Y="480"T="0"/></S><D><DS Y="365"X="400"/></D><O/></Z></C>';

table.foreach({string,math,table,tfm.exec,system,ui}, function(num,libs) for i,v in pairs(libs) do _G= v; end end)
foreach({'AfkDeath','AutoScore','AutoShaman','AutoNewGame','AutoTimeLeft'}, function(n,v) _G['disable'..v](true) end)

eventMessage= function(i)
return g and i or addTextArea(1, eventWinners(), nil,103,21,590,nil,1,1,1) or i;
end

eventNewPlayer= function(p)
w
= bindKeyboard(p,17,true) or bindKeyboard(p,17,false) or w

or 0;
end

eventNewGame= function()
g, tb, cn, tM= false, removeTextArea(1) or {}, setGameTime(180) or false, setMapName(char(35,100,111,100,103,101)) or 0;
end

eventKeyboard= function(p,id,dw)
({t= function() addTextArea(2, eventRanking(), p, 50, 70) end; f= function() removeTextArea(2,p) end})[tostring(dw):sub(0,1)]()
end

eventRanking= function()
local l, txt, r= {}, '<n>%02d. <v>%s<n><j>%s', '<font face="Lucida Console"><r>##. Player Victories\n';
a= foreach(tfm.get.room.playerList, function(i,v) l[#l +1]= {s=w, n=i}; end) or sort(l, function(a,b) return a.s > b.s; end);
return foreach(l, function(i,v) r= i < 11 and r..'\n'..txt:format(i, v.n..(' '):rep(14 -#v.n), v.s) or r; end) or r;
end

eventPlayerDied= function(p)
v= 0; foreach(tfm.get.room.playerList, function(i,p) v= p.isDead == false and v +1 or v; end)
v= v == 1 and eventMessage(v) or v == 0 and eventLoop(0,0);
end

eventLoop= function(a,b)
tM= not tM and 1/2 or tM +1/2;
tM= tM == 175 and eventMessage(tM) or (tM == 180 or b <= 0) and newGame(mapa) or tM;
cn= tM == 5 and true or cn and addShamanObject(17, 801, random(100,375), random(-135,-30)) or cn;
end

eventWinners= function()
str, cn, g= setGameTime(4) or '<j><p align="center"><font face="Lucida Console" size="20">%s: <v>%s', false, true;
foreach(tfm.get.room.playerList, function(p,c) t= not c.isDead; tb[#tb +1], w

= t and p or nil, t and w

+1 or w

; end)
return str:format(char(86,105,99,116,111,114)..(#tb > 1 and char(101,115) or ''), concat(tb, '<j>, <v>')..'<j>!');
end

main= eventLoop(0,0) or foreach(tfm.get.room.playerList, eventNewPlayer);

Try loading the script from this link (Ctrl+A and Ctrl+C).

that worked but i also found that when i try to play alone to practice if i die i'm respawned right away while there's still cannons and if i die again too quick i get this error

• # [*Manga Anime Society] You can't call this function [tfm.exec.newGame] more than once per 3 seconds.

and i don't respawn at all and if i let the game continue running it crashes with this error

• # [*Manga Anime Society] Runtime Error : org.luaj.vm2.LuaError: Himitsu_no_yami.lua:25: vm error: java.lang.NegativeArraySizeException
Dad_yx
« Citoyen »
1491242160000
    • Dad_yx#3534
    • Profil
    • Derniers messages
#2535
  0
1.Attack script (when someone attack)
2.Attacking ballons (when ballon fly to player to attack it)
3.Health script and description script
Propkraigg
1491246720000
    • Propkraigg#0000
    • Profil
    • Derniers messages
    • Tribu
#2536
[Modéré par Shamousey, raison : Please give information about what you want done when you make a request.]
Onkei
« Citoyen »
1491497880000
    • Onkei#0000
    • Profil
    • Derniers messages
    • Tribu
#2537
  0
Xymessiyx a dit :
1.Attack script (when someone attack)
2.Attacking ballons (when ballon fly to player to attack it)
3.Health script and description script

Not sure if this is even remotely close to what you want, I tried to be fancy and overcomplicated things with OOP


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
local Vector = {}
local Player = {}
local Balloon = {}

local players = {}
local balloons = {}

local settings = {numOfBalloons = 10, maxPlayerHP = 20, playerHitDmg = 5, maxBalloonHP = 10, balloonHitDmg = 2.5, maxBalloonSpeed = 40}

-- Vector class to simplify managing X / Y positions.
function Vector.new(x, y)
local self = {}

self.x = x or 0
self.y = y or 0

function self:add(vector)
vector = vector or Vector.new()
self.x = self.x + (vector.x or 0)
self.y = self.y + (vector.y or 0)
end

function self:isNear(vector, range)
vector = vector or Vector.new()
range = range or 10
-- Calculating the distance between the two vectors by taking their coordinate positions.
local xDist = math.abs(self.x - (vector.x or 0))
local yDist = math.abs(self.y - (vector.y or 0))
if xDist < range and yDist < range then
return true
end
return false
end

return self
end

function Player.new(name)
local self = {}

self.name = name
self.hp = settings.maxPlayerHP

function self:getCoords() -- Returning the player's coordinates as a Vector object.
local data = tfm.get.room.playerList[self.name]
return Vector.new(data.x, data.y)
end

function self:attack(balloon)
local data = tfm.get.room.playerList[self.name]
if data.isDead then return end

tfm.exec.playEmote(self.name, 15)

if balloon.pos:isNear(Vector.new(data.x, data.y), 40) then
balloon.hp = balloon.hp - settings.playerHitDmg
end
end

function self:checkIsDead()
if self.hp <= 0 then
return true
end

return false
end

function self:showHP()
local len = map(self.hp, 0, settings.maxPlayerHP, 40, 300)
ui.addTextArea(0, "", self.name, 10, 20, 300, 20, 0x324650, 0x89a7f5, 0.7, true)
ui.addTextArea(1, "<p align='center'>" .. tostring(self.hp), self.name, 10, 20, len, 20, 0x171918, 0x171918, 0.5, true)
end

return self
end

function Balloon.new(objectId)
local self = {}

self.id = nil
self.hp = settings.maxBalloonHP
self.isDead = false

self.objectId = objectId or 28
self.pos = Vector.new(math.random(0, 800), math.random(0, 300))
self.acc = Vector.new()

function self:spawn()
self.id = tfm.exec.addShamanObject(self.objectId, self.pos.x, self.pos.y)
end

function self:update()
if self.isDead then return end -- If bloon is dead don't do anything.

self.acc:add(Vector.new(math.random(-settings.maxBalloonSpeed, settings.maxBalloonSpeed), math.random(-settings.maxBalloonSpeed, settings.maxBalloonSpeed)))

if self.hp <= 0 then self.isDead = true end
end

function self:move()
if self.isDead then return end

local data = tfm.get.room.objectList[self.id]
tfm.exec.moveObject(self.id, self.pos.x, self.pos.y, false, self.acc.x, self.acc.y, false, 0, false) -- Make it bounce back and forth from the same pos.

self.acc = Vector.new()
end

function self:attack(player)
if self.isDead then return end

if self.pos:isNear(player:getCoords(), 40) then
player.hp = player.hp - settings.balloonHitDmg
if player:checkIsDead() then tfm.exec.killPlayer(player.name) end
end
end

return self
end

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function map(value, start1, stop1, start2, stop2)
local value2 = ((value - start1) / (stop1 - start1)) * (stop2 - start2) + start2
return value2
end

function eventNewGame()
balloons = {}

for n in pairs(tfm.get.room.playerList) do
players[n].hp = settings.maxPlayerHP
end

for i = 1, settings.numOfBalloons, 1 do
balloons[i] = Balloon.new()
balloons[i]:spawn()
end
end

function eventLoop()
if #balloons > 0 then
for i = 1, #balloons, 1 do
balloons[i]:update()
balloons[i]:move()

for n in pairs(tfm.get.room.playerList) do
-- Each balloon will check if they're near a player to attack.
balloons[i]:attack(players[n])
end
end
end

for n in pairs(tfm.get.room.playerList) do
if players[n].hp < settings.maxPlayerHP then players[n].hp = players[n].hp + 0.5 end
players[n]:showHP()
end
end

function eventNewPlayer(n)
players[n] = Player.new(n)
tfm.exec.bindKeyboard(n, 32, true, true)

eventChatCommand(n, "help")
end

function eventKeyboard(n, key, down, x, y)
if key == 32 and #balloons > 0 then
for i = 1, #balloons, 1 do
players[n]:attack(balloons[i])
end
end
end

function eventChatCommand(n, cmd)
if cmd == "help" or cmd == "info" then
local text =
"<p align='center'>" ..
"Welcome to this random script by Onkei!<br><br>" ..
"Every round, random balloons spawn around the map.<br>" ..
"You must kill the bloons with Spacebar!<br>" ..
"They will also do damage to you if the bloons are not dead.<br>" ..
"Bloons are dead if they fly up normally.<br><br>" ..
"Nothing happens at the end.."

ui.addPopup(1, 0, text, n, 140, 100, 520, true)
end
end

main()
eventNewGame()

Dernière modification le 1491502380000
Dad_yx
« Citoyen »
1491671040000
    • Dad_yx#3534
    • Profil
    • Derniers messages
#2538
  0
Onkei a dit :
Xymessiyx a dit :
1.Attack script (when someone attack)
2.Attacking ballons (when ballon fly to player to attack it)
3.Health script and description script

Not sure if this is even remotely close to what you want, I tried to be fancy and overcomplicated things with OOP


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
local Vector = {}
local Player = {}
local Balloon = {}

local players = {}
local balloons = {}

local settings = {numOfBalloons = 10, maxPlayerHP = 20, playerHitDmg = 5, maxBalloonHP = 10, balloonHitDmg = 2.5, maxBalloonSpeed = 40}

-- Vector class to simplify managing X / Y positions.
function Vector.new(x, y)
local self = {}

self.x = x or 0
self.y = y or 0

function self:add(vector)
vector = vector or Vector.new()
self.x = self.x + (vector.x or 0)
self.y = self.y + (vector.y or 0)
end

function self:isNear(vector, range)
vector = vector or Vector.new()
range = range or 10
-- Calculating the distance between the two vectors by taking their coordinate positions.
local xDist = math.abs(self.x - (vector.x or 0))
local yDist = math.abs(self.y - (vector.y or 0))
if xDist < range and yDist < range then
return true
end
return false
end

return self
end

function Player.new(name)
local self = {}

self.name = name
self.hp = settings.maxPlayerHP

function self:getCoords() -- Returning the player's coordinates as a Vector object.
local data = tfm.get.room.playerList[self.name]
return Vector.new(data.x, data.y)
end

function self:attack(balloon)
local data = tfm.get.room.playerList[self.name]
if data.isDead then return end

tfm.exec.playEmote(self.name, 15)

if balloon.pos:isNear(Vector.new(data.x, data.y), 40) then
balloon.hp = balloon.hp - settings.playerHitDmg
end
end

function self:checkIsDead()
if self.hp <= 0 then
return true
end

return false
end

function self:showHP()
local len = map(self.hp, 0, settings.maxPlayerHP, 40, 300)
ui.addTextArea(0, "", self.name, 10, 20, 300, 20, 0x324650, 0x89a7f5, 0.7, true)
ui.addTextArea(1, "<p align='center'>" .. tostring(self.hp), self.name, 10, 20, len, 20, 0x171918, 0x171918, 0.5, true)
end

return self
end

function Balloon.new(objectId)
local self = {}

self.id = nil
self.hp = settings.maxBalloonHP
self.isDead = false

self.objectId = objectId or 28
self.pos = Vector.new(math.random(0, 800), math.random(0, 300))
self.acc = Vector.new()

function self:spawn()
self.id = tfm.exec.addShamanObject(self.objectId, self.pos.x, self.pos.y)
end

function self:update()
if self.isDead then return end -- If bloon is dead don't do anything.

self.acc:add(Vector.new(math.random(-settings.maxBalloonSpeed, settings.maxBalloonSpeed), math.random(-settings.maxBalloonSpeed, settings.maxBalloonSpeed)))

if self.hp <= 0 then self.isDead = true end
end

function self:move()
if self.isDead then return end

local data = tfm.get.room.objectList[self.id]
tfm.exec.moveObject(self.id, self.pos.x, self.pos.y, false, self.acc.x, self.acc.y, false, 0, false) -- Make it bounce back and forth from the same pos.

self.acc = Vector.new()
end

function self:attack(player)
if self.isDead then return end

if self.pos:isNear(player:getCoords(), 40) then
player.hp = player.hp - settings.balloonHitDmg
if player:checkIsDead() then tfm.exec.killPlayer(player.name) end
end
end

return self
end

function main()
for n in pairs(tfm.get.room.playerList) do
eventNewPlayer(n)
end
end

function map(value, start1, stop1, start2, stop2)
local value2 = ((value - start1) / (stop1 - start1)) * (stop2 - start2) + start2
return value2
end

function eventNewGame()
balloons = {}

for n in pairs(tfm.get.room.playerList) do
players[n].hp = settings.maxPlayerHP
end

for i = 1, settings.numOfBalloons, 1 do
balloons[i] = Balloon.new()
balloons[i]:spawn()
end
end

function eventLoop()
if #balloons > 0 then
for i = 1, #balloons, 1 do
balloons[i]:update()
balloons[i]:move()

for n in pairs(tfm.get.room.playerList) do
-- Each balloon will check if they're near a player to attack.
balloons[i]:attack(players[n])
end
end
end

for n in pairs(tfm.get.room.playerList) do
if players[n].hp < settings.maxPlayerHP then players[n].hp = players[n].hp + 0.5 end
players[n]:showHP()
end
end

function eventNewPlayer(n)
players[n] = Player.new(n)
tfm.exec.bindKeyboard(n, 32, true, true)

eventChatCommand(n, "help")
end

function eventKeyboard(n, key, down, x, y)
if key == 32 and #balloons > 0 then
for i = 1, #balloons, 1 do
players[n]:attack(balloons[i])
end
end
end

function eventChatCommand(n, cmd)
if cmd == "help" or cmd == "info" then
local text =
"<p align='center'>" ..
"Welcome to this random script by Onkei!<br><br>" ..
"Every round, random balloons spawn around the map.<br>" ..
"You must kill the bloons with Spacebar!<br>" ..
"They will also do damage to you if the bloons are not dead.<br>" ..
"Bloons are dead if they fly up normally.<br><br>" ..
"Nothing happens at the end.."

ui.addPopup(1, 0, text, n, 140, 100, 520, true)
end
end

main()
eventNewGame()

It isnt work i click accept and nothing happended :(
Dad_yx
1491671160000
    • Dad_yx#3534
    • Profil
    • Derniers messages
#2539
[Modéré par Veralidaine, raison : Multi-post. Please edit your original post by clicking on your avatar and selecting "edit" instead.]
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 127 / 160 › »
© Atelier801 2018

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

Version 1.27