×

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
« ‹ 151 / 160 › »
Script Requests
Bolodefchoco
« Sénateur »
1540038780000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#3001
  2
Hypermousem a dit :
Meeddal a dit :
Hello what i must write to take transformation from all players?

tfm.exec.giveTransformations (playerName,canTransform)

Here's a slightly clearer explanation. This person and I are working on a script or our tribe and two functions don't seem to work for everyone in the room - namely tm.exec.giveMeep and tfm.exec.giveTransformations. I tried doing it like this:
Code Lua

1
2
tfm.exec.giveMeep(tfm.get.room.playerList[nil],true)
tfm.exec.giveTransformations(tfm.get.room.playerList[nil],true)
But it results in this:
• [10:26] # [*Kompania X] tfm.exec.giveMeep : argument 1 can't be NIL.
• [10:26] # [*Kompania X] tfm.exec.giveTransformations : argument 1 can't be NIL.
Are there any ways to make these functions work for every player in the room, or are they just made that way so that they can't be used for everyone?

EDIT: seems like I found a solution already.

It's impossible to have a "nil" index in a table, that's not how lua works. You must iterate over the table to make it to everyone.

Use table.foreach(tfm.get.room.playerList, tfm.exec.giveMeep)
Ace
« Consul »
1540369680000
    • Ace#1270
    • Profil
    • Derniers messages
#3002
  0
anyone have example for a leaderboard ?
Owl
« Citoyen »
1540709460000
    • Owl#3124
    • Profil
    • Derniers messages
    • Tribu
#3003
  0
Freeze a player, is it possible? Or make them can't move
Sebafrancuz
« Consul »
1540727520000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#3004
  0
Owl a dit :
Freeze a player, is it possible? Or make them can't move

No, you can't.
You can only make that it teleports player to the same position every 0.5 sec (but player can move)

Dernière modification le 1540727580000
Campwolf
« Citoyen »
1540762140000
    • Campwolf#8695
    • Profil
    • Derniers messages
    • Tribu
#3005
  0
Script where at the beginning of the game can name your character then instead of your username it's your character's name.

Is it possible to shoot like maybe a cannon? Then when someone even touches it they die?
Syrius
« Consul »
1541169540000
    • Syrius#8114
    • Profil
    • Derniers messages
    • Tribu
#3006
  0
how to table.foreach the APIs that require more variables (tfm.exec.setShaman(<all players>,false) ?

Dernière modification le 1541170800000
Bolodefchoco
« Sénateur »
1541174040000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#3007
  0
Syrius a dit :
how to table.foreach the APIs that require more variables (tfm.exec.setShaman(<all players>,false) ?

you can not, unless you create a function

Code Lua

1
2
3
table.foreach(tfm.get.room.playerList, function(playerName)
tfm.exec.setShaman(playerName, false)
end)

But if you're going to use it, then use the generic for that is faster
Code Lua

1
2
3
for playerName in next, tfm.get.room.playerList do
tfm.exec.setShaman(playerName, false)
end

Dernière modification le 1541174100000
Icraatsifir
« Citoyen »
1541224260000
    • Icraatsifir#8426
    • Profil
    • Derniers messages
    • Tribu
#3008
  0
example i clicked a then b how could i print "ab"?
like addition but with words

srry for bad english

Dernière modification le 1541224320000
Ace
« Consul »
1541273280000
    • Ace#1270
    • Profil
    • Derniers messages
#3009
  0
I need Afk command !Afk . if you use it you won't be shaman . if you use it again you will back to the game.
Lua
« Citoyen »
1541298540000
    • Lua#1908
    • Profil
    • Derniers messages
    • Tribu
#3010
  0
Hello, somebody knows the water and spider web values? please i need it for Physics Objects!
Sebafrancuz
« Consul »
1541325360000
    • Sebafrancuz#0000
    • Profil
    • Derniers messages
    • Tribu
#3011
  0
Lua a dit :
Hello, somebody knows the water and spider web values? please i need it for Physics Objects!

https://i.gyazo.com/77f23da0216aa906eba3dbdce988a31b.png
From there:
https://atelier801.com/topic?f=5&t=451587&p=1#m2

or just make a code:
Code Lua

1
2
3
for name, id in next, tfm.enum.ground do
print("id: "..id.." name: "..name)
end

Dernière modification le 1541325480000
Lua
« Citoyen »
1541363220000
    • Lua#1908
    • Profil
    • Derniers messages
    • Tribu
#3012
  0
Sebafrancuz a dit :
Lua a dit :
Hello, somebody knows the water and spider web values? please i need it for Physics Objects!

https://i.gyazo.com/77f23da0216aa906eba3dbdce988a31b.png
From there:
https://atelier801.com/topic?f=5&t=451587&p=1#m2

or just make a code:
Code Lua

1
2
3
for name, id in next, tfm.enum.ground do
print("id: "..id.." name: "..name)
end

I know the ID. but i mean, the bodyDef values... " fixedRotation (Boolean), mass (Int), linearDamping (Float), angularDamping (Float) "

to achieve the effect of spider web or water
Bolodefchoco
« Sénateur »
1541367120000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#3013
  0
Lua a dit :
Sebafrancuz a dit :
Lua a dit :
Hello, somebody knows the water and spider web values? please i need it for Physics Objects!

https://i.gyazo.com/77f23da0216aa906eba3dbdce988a31b.png
From there:
https://atelier801.com/topic?f=5&t=451587&p=1#m2

or just make a code:
Code Lua

1
2
3
for name, id in next, tfm.enum.ground do
print("id: "..id.." name: "..name)
end

I know the ID. but i mean, the bodyDef values... " fixedRotation (Boolean), mass (Int), linearDamping (Float), angularDamping (Float) "

to achieve the effect of spider web or water

Use miceCollision = false
Icraatsifir
« Citoyen »
1541439180000
    • Icraatsifir#8426
    • Profil
    • Derniers messages
    • Tribu
#3014
  0
Icraatsifir a dit :
example i clicked a then b how could i print "ab"?
like addition but with words

srry for bad english
Lua
« Citoyen »
1541448480000
    • Lua#1908
    • Profil
    • Derniers messages
    • Tribu
#3015
  0
it is possible to remove the start countdown of each map? (3..2...1)
Icraatsifir
« Citoyen »
1541473200000
    • Icraatsifir#8426
    • Profil
    • Derniers messages
    • Tribu
#3016
  0
Icraatsifir a dit :
Icraatsifir a dit :
example i clicked a then b how could i print "ab"?
like addition but with words

srry for bad english


Pls
Urook
« Citoyen »
1541883480000
    • Urook#1131
    • Profil
    • Derniers messages
    • Tribu
#3017
  0
Campwolf : Script where at the beginning of the game can name your character then instead of your username it's your character's name
If you wanted to change the player's name, then you can't. Or else, when you told "at the beginning of the game", do you mean when a player joins? If yes then
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
players={} --create a table that stores players data
function eventNewPlayer(playerName) --when a player joins
ui.addPopup (0, 2, "Name your character:", playerName, 200, 180, 400, true) --ask him to give a name to his character
players[playerName]={characterName=""} --this will be the player's character name
end
table.foreach(tfm.get.room.playerList, eventNewPlayer)

function eventPopupAnswer(popupId, playerName, answer)
if popupId == 0 then --when the player answers the right popup (ID = 0)
if answer == "" then --if the player didn't give a name for his character, ask him again.
ui.addPopup (0, 2, "Name your character:", playerName, 200, 180, 400, true)
else --if he did, then gives the player the character name he chose
players[playerName]={characterName=answer}
print(players[playerName].characterName) --prints the player's character name (not needed, only for debug)
end
end
end
Campwolf : Is it possible to shoot like maybe a cannon? Then when someone even touches it they die?
I'm not sure if it's the best way to do it, but i think it is. You can't make a player die by touching a cannon with lua, you must use maps having the aie="" parameter. You can add a cooldown using this thread by Bolodefchoco : Cooldown logic
Code Lua

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function eventNewPlayer(playerName) --when a player joins
table.foreach({32,40,83}, function(_,v) system.bindKeyboard(playerName, v, true, true) end) --bind keys space (32), down arrow (40) and S (83)
end
table.foreach(tfm.get.room.playerList, eventNewPlayer)

function eventKeyboard(playerName, keyCode, down, xPlayerPosition, yPlayerPosition)
if (keyCode == 32 or keyCode == 40 or keyCode == 83) and tfm.get.room.playerList[playerName].isDead == false then --when the player presses space or ducks, he musn't be dead
if tfm.get.room.playerList[playerName].isFacingRight then --if the player is facing right
tfm.exec.addShamanObject(17, xPlayerPosition+20, yPlayerPosition, 90, 1, 0, false) --shoots a cannon to the right
else --if the player is facing left
tfm.exec.addShamanObject(17, xPlayerPosition-20, yPlayerPosition, -90, -1, 0, false) --shoots a cannon to the left
end
end
end

Dernière modification le 1543067760000
Overjoy06
« Citoyen »
1543042320000
    • Overjoy06#0000
    • Profil
    • Derniers messages
    • Tribu
#3018
  0
one question (i haven't lua code since i dont know when so i am refreshing some stuff)
can you change the font of the textArea?
if yes then what is the fonts i can use
Bolodefchoco
« Sénateur »
1543065060000
    • Bolodefchoco#0095
    • Profil
    • Derniers messages
    • Tribu
#3019
  0
Overjoy06 a dit :
one question (i haven't lua code since i dont know when so i am refreshing some stuff)
can you change the font of the textArea?
if yes then what is the fonts i can use

Yes.

Example:
"<font face='Verdana, Arial, Courier'>Hi</font>"

In this case, if the user has the font Verdana, then it's gonna be Verdana, otherwise Arial, or Courier, or the standard font of Transformice.

You can use ANY font, but the user must have it on his computer in order to see it correctly.
I recommend you to use only Windows fonts (official ones), since most of the people use it
Athesdrake
« Citoyen »
1543065300000
    • Athesdrake#0000
    • Profil
    • Derniers messages
    • Tribu
#3020
  0
Overjoy06 a dit :
one question (i haven't lua code since i dont know when so i am refreshing some stuff)
can you change the font of the textArea?
if yes then what is the fonts i can use

Yes you can.

^Ninja X_x
Code Lua

1
2
3
text = '<font face="Webdings">What are those characters ?</p>' -- Webdings is a weird font made of icon

ui.addTextArea(1, text, nil, 350, 185, 100, 30, nil, nil, 1, true)
Result

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


You can use any font installed on your computer.
The fonts installed by default depend of your operating system and its version.

Dernière modification le 1543065360000
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • Script Requests
« ‹ 151 / 160 › »
© Atelier801 2018

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

Version 1.27