Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Pre-Match Map Preview
- // @namespace http://www.reddit.com/user/happytagpro/
- // @include http://tagpro-*.koalabeast.com:*
- // @include http://tangent.jukejuice.com:*
- // @include http://maptest.newcompte.fr:*
- // @author happy
- // @version 0.2
- // ==/UserScript==
- extraTime = 2 //increase this if you want more time between when the view zooms in and when the game starts. measured in seconds
- zoom = 3.5 //initial zoom level
- animationTime = 2 //duration of animation. set to 0 if you want to remove animation
- tagpro.socket.on('time',function(message){
- frequency = 20
- interval = (zoom-1)/(animationTime*(1000/frequency))
- //use the time left until game starts and the time that the animation takes to calculate when the animation needs to start in order to reach normal zoom at game time.
- delay = (message.time/1000-animationTime)*1000-400-extraTime*1000
- if (message.state == 3) {
- //store power up tiles
- a=tagpro.tiles[6.1]
- b=tagpro.tiles[6.2]
- c=tagpro.tiles[6.3]
- //replace power up tiles with generic ones, I used the fourth, unused power-up tile as my 'generic' tile
- var generic = tagpro.tiles[6.4]
- tagpro.tiles[6.1] = generic
- tagpro.tiles[6.2] = generic
- tagpro.tiles[6.3] = generic
- changed=true
- tagpro.api.redrawBackground()
- tagpro.zoom=zoom
- setTimeout(function(){
- id=setInterval(function(){
- zoom=zoom-interval
- tagpro.zoom=zoom
- //when zoomed in stop animation and replace original power-up tiles
- if (zoom <= 1) {
- clearInterval(id)
- tagpro.zoom=1
- tagpro.tiles[6.1] = a
- tagpro.tiles[6.2] = b
- tagpro.tiles[6.3] = c
- tagpro.api.redrawBackground()
- }
- },frequency)
- },delay)
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement