×

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] Portal Gun
1 / 3 › »
[Script] Portal Gun
Mikuhl
« Citoyen »
1384207440000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#1
  1
Portal Gun! Click anywhere to shoot.

EDIT: Updated. Portals now instantly spawn on the nearest wall. With the help of Izstas making the line look nice.

http://pastebin.com/raw.php?i=CvdZMDyw

a dit :

tfm.exec.disableAutoScore(false)
tfm.exec.disableAutoShaman(true)
tfm.exec.disableAutoNewGame(true)
grounds = {}
tm = os.time()
tfm.exec.newGame("@4694243")


function eventNewPlayer(name)
system.bindMouse(name, true)
tfm.exec.respawnPlayer(name)
end

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

function eventNewGame()
width = tonumber(tfm.get.room.xmlMapInfo.xml:match('<P[^/]+L="([^"]+)"[^/]+/>'))
if not width then
width = 800
end
height = tonumber(tfm.get.room.xmlMapInfo.xml:match('<P[^/]+H="([^"]+)"[^/]+/>'))
if not height then
height = 400
end
grounds = {}
for ground in tfm.get.room.xmlMapInfo.xml:gmatch("<S[^/]+/>") do
local pos = #grounds+1
grounds[pos] = {}
grounds[pos].X = tonumber(ground:match('X="([^"]+)"'))
grounds[pos].Y = tonumber(ground:match('Y="([^"]+)"'))
grounds[pos].L = tonumber(ground:match('L="([^"]+)"'))
grounds[pos].H = tonumber(ground:match('H="([^"]+)"'))
grounds[pos].T = tonumber(ground:match('T="([^"]+)"'))
end
end

function eventMouse(name, x2, y2)
if os.time() >= tm + 1000 then
local player = tfm.get.room.playerList[name]
local deltaX = x2 - player.x
local deltaY = y2 - player.y
local normalizer = math.sqrt(math.pow(deltaX, 2) + math.pow(deltaY, 2))
deltaX = deltaX / normalizer
deltaY = deltaY / normalizer
for t = 0, math.huge, math.min(math.abs(5 / deltaX), math.abs(5 / deltaY)) do
x = player.x + deltaX * t
y = player.y + deltaY * t
if x < 0 or x > width or y < 0 or y > height then
break
end
for i,ground in ipairs(grounds) do
if x > ground.X - ground.L/2 and x < ground.X + ground.L/2 and y > ground.Y - ground.H/2 and y < ground.Y + ground.H/2 and ground.T ~= (8 or 9) then
brk = true
break
end
end
if brk then
brk = false
if not prtl then
tfm.exec.addShamanObject(26, player.x + deltaX * (t - 15), player.y + deltaY * (t - 15))
prtl = true
else
tfm.exec.addShamanObject(27, player.x + deltaX * (t - 15), player.y + deltaY * (t - 15))
prtl = false
end
break
end
if not prtl then
tfm.exec.displayParticle(9, x , y, 0, 0, 0, 0)
else
tfm.exec.displayParticle(2, x , y, 0, 0, 0, 0)
end
end
tm = os.time()
end
end

function eventPlayerDied(name)
tfm.exec.respawnPlayer(name)
end

eventPlayerWon = eventPlayerDied

NEW: http://pastebin.com/raw.php?i=CvdZMDyw

OLD: http://pastebin.com/raw.php?i=qibZXAV3
Skinnyfatlegend
« Citoyen »
1384208880000
    • Skinnyfatlegend#2903
    • Profil
    • Derniers messages
    • Tribu
#2
  0
This works like a charm *-*. I made a shooting example before but my computer shut down before I could save it ;;
Xxninjazxx
« Citoyen »
1384209000000
    • Xxninjazxx#0000
    • Profil
    • Derniers messages
#3
  0
Oh I like this...
Grimrice
« Citoyen »
1384212720000
    • Grimrice#0000
    • Profil
    • Derniers messages
    • Tribu
#4
  0
[•] Init Error : [string "transformice.lua"]:1: unexpected symbol
[•] [Grimrice] Lua script loaded in 1 ms (4000 max)
Mikuhl
« Citoyen »
1384213080000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#5
  0
Grimrice a dit :
[•] Init Error : [string "transformice.lua"]:1: unexpected symbol
[•] [Grimrice] Lua script loaded in 1 ms (4000 max)

Something probably went wrong when you copy and pasted it, since it is the first line.
Make sure you didnt type a v before you pasted it.
Tummnus
« Citoyen »
1384220280000
    • Tummnus#0000
    • Profil
    • Derniers messages
    • Tribu
#6
  0
I find it funny because yesterday while I was falling asleep I was thinking of a new minigame to make and I thought of something that has to do with Portal guns but instead of arrows I had thought of cannons.
Mousechris
« Censeur »
1384223460000
    • Mousechris#0000
    • Profil
    • Derniers messages
    • Tribu
#7
  0
how do I shoot portals

nvm it's click
Xxninjazxx
« Citoyen »
1384292220000
    • Xxninjazxx#0000
    • Profil
    • Derniers messages
#8
  0
Tummnus a dit :
I find it funny because yesterday while I was falling asleep I was thinking of a new minigame to make and I thought of something that has to do with Portal guns but instead of arrows I had thought of cannons.

please, I've been thinking about a portal gun minigame since I discovered baffbot (and it could still play music then too)

Of coure, I've been too lazy too suggest it.
Grimrice
« Citoyen »
1384292700000
    • Grimrice#0000
    • Profil
    • Derniers messages
    • Tribu
#9
  0
its very unresponsive and slow :c
Mikuhl
« Citoyen »
1384292700000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#10
  0
Grimrice a dit :
its very unresponsive and slow :c

Thats TFM for ya!
Xxninjazxx
« Citoyen »
1384293240000
    • Xxninjazxx#0000
    • Profil
    • Derniers messages
#11
  0
if you spam click it will just pop up some random location (The top left corner seems the most common)
Fuzzykeldeo
« Citoyen »
1384314060000
    • Fuzzykeldeo#0000
    • Profil
    • Derniers messages
#12
  0
Me: "OMG YES, NO ONE'S ONLINE. Now it's time to try out a new script &gt;:3"


5 minutes later: "WHY ARE THE PORTALS SPAWNING OVER THERE? ;O;"
Ethanrockz
« Citoyen »
1385646960000
    • Ethanrockz#0000
    • Profil
    • Derniers messages
    • Tribu
#13
  0
can you make it if its an orange portal the rune is orange?
Mikuhl
« Citoyen »
1385671680000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#14
  0
Ethanrockz a dit :
can you make it if its an orange portal the rune is orange?

I could but it wouldnt work as well. It uses the regular runes ability to cling to walls. Stable runes dont do that very well.
Rocatv
« Citoyen »
1385677920000
    • Rocatv#0000
    • Profil
    • Derniers messages
    • Tribu
#15
  0
alex tv
Vahvlipoiss
« Citoyen »
1386457320000
    • Vahvlipoiss#0000
    • Profil
    • Derniers messages
    • Tribu
#16
  0
i wrote --> /lua and i pasted code there but i dont get portal gun wha to do?
Tailtong
« Citoyen »
1386457560000
    • Tailtong#0000
    • Profil
    • Derniers messages
    • Tribu
#17
  0
You click around the map.
Mouldychesse
« Citoyen »
1386697800000
    • Mouldychesse#0000
    • Profil
    • Derniers messages
    • Tribu
#18
  0
I have a map that's kinda like portal
@1820179

(Not mine)
Is this the only map?
Otroivan
« Citoyen »
1387915380000
    • Otroivan#0000
    • Profil
    • Derniers messages
    • Tribu
#19
  0
Controls?
Mikuhl
« Citoyen »
1387984740000
    • Mikuhl#3311
    • Profil
    • Derniers messages
    • Tribu
#20
  0
Jaackster a dit :
Click anywhere to shoot.

.
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Script] Portal Gun
1 / 3 › »
© Atelier801 2018

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

Version 1.27