games = world.getGames(); speed1 = event.addMoveData(loc.new(games, 1999,53, -997), loc.new(games, 2001,54,-995), 5, -1); speed2 = event.addMoveData(loc.new(games, 2016,64, -997), loc.new(games, 2018,65,-995), 5, -1); jump1 = event.addMoveData(loc.new(games, 1999,53, -995), loc.new(games, 2001,54,-990), 5, -1); jump2 = event.addMoveData(loc.new(games, 2011,60, -1001), loc.new(games, 2013,61,-999), 5, -1); jump3 = event.addMoveData(loc.new(games, 2014,59, -984), loc.new(games, 2016,60,-982), 5, -1); Portal1 = event.addMoveData(loc.new(games, 2005,59, -983), loc.new(games, 2006,61, -982), 5, -1); Portal2 = event.addMoveData(loc.new(games, 2007,60,-1001), loc.new(games, 2008,61,-1000), 5, -1); Portal3 = event.addMoveData(loc.new(games, 2017,62, -989), loc.new(games, 2018,63, -988), 5, -1); Portal4 = event.addMoveData(loc.new(games, 1999,65, -995), loc.new(games, 2000,67, -994), 5, -1); Portal5 = event.addMoveData(loc.new(games, 2009,53,-1001), loc.new(games, 2010,55,-1000), 5, -1); Portal6 = event.addMoveData(loc.new(games, 2017,53, -993), loc.new(games, 2018,55, -992), 5, -1); end = event.addMoveData(loc.new(games, 2010, 65, -990), loc.new(games, 2009, 67, -992), 5, -1); portals = map.new(); map.add(portals, Portal1, portal.create(loc.new(games, 2007.5,60,-1000.5), loc.new(games, 2005.5,59, -982.5), "east", "east")); map.add(portals, Portal2, portal.create(loc.new(games, 2005.5,59, -982.5), loc.new(games, 2007.5,60,-1000.5), "east", "east")); map.add(portals, Portal3, portal.create(loc.new(games, 1999.5,65, -994.5), loc.new(games, 2017.5,62, -988.5), "south", "north")); map.add(portals, Portal4, portal.create(loc.new(games, 2017.5,62, -988.5), loc.new(games, 1999.5,65, -994.5), "south", "north")); map.add(portals, Portal5, portal.create(loc.new(games, 2017.5,53, -992.5), loc.new(games, 2009.5,53,-1000.5), "east", "south")); map.add(portals, Portal6, portal.create(loc.new(games, 2009.5,53,-1000.5), loc.new(games, 2017.5,53, -992.5), "south", "east")); id_effects = map.new(); map.add(id_effects, speed1, "speed_gel"); map.add(id_effects, speed2, "speed_gel"); map.add(id_effects, jump1, "jump_gel"); map.add(id_effects, jump2, "jump_gel"); map.add(id_effects, jump3, "jump_gel"); map.add(id_effects, Portal1, "portal"); map.add(id_effects, Portal2, "portal"); map.add(id_effects, Portal3, "portal"); map.add(id_effects, Portal4, "portal"); map.add(id_effects, Portal5, "portal"); map.add(id_effects, Portal6, "portal"); map.add(id_effects, end, "end"); //---------------------------------------------------- sign.started(gamesignloc); event.load("player_move"); event.load("entity_damage"); event.load("player_move"); event.load("player_quit"); event.load("player_giveup"); event.load("minigame_join"); event.load("block_break"); gamename = "§aPortal"; maxplayers = 1; //---------------------------------------------------- @wait wait(); if(event == "entity_damage") { if(!isPlayer(entity)) { goto("wait"); } player = entity; } if(!player.hasMinigameId(player, script_id)) { goto("wait"); } if(event == "player_move"){ move_type = map.getOrDefault(id_effects, id, "none"); if(move_type == "speed_gel"){ gel.speed(player); } elseif(move_type == "jump_gel"){ gel.jump(player); } elseif(move_type == "portal"){ portal.enter(player, id); } elsif(move_type == "end"){ game_stop("You did it!"); } } if(event == "block_break"){ cancel = true; goto("wait"); } if(event == "entity_damage") { cancel = true; goto("wait"); } if(event == "player_quit"){ game_stop(null); } if(event == "player_giveup"){ game_stop("You have left the game"); } goto("wait"); //---------------------------------------------------- function gel.speed(player){ living.addEffect(player,"SPEED",5,3,true); } function gel.jump(player){ if(!player.isSneaking(player)){ motion = entity.getMotion(player); look = entity.getLook(player); x = motion[0]+look[0]/3; y = 1.01; z = motion[2]+look[2]/3; entity.setMotion(player, x, y, z); } } function portal.create(to_loc, mid_loc, Direction_in, Direction_out){ array = array.new(4); array[0] = Direction_in;//east // south array[1] = Direction_out;//east -> +X, west -> -X, south -> +Z, north -> -Z array[2] = to_loc; array[3] = mid_loc; return array; } function portal.enter(player, id){ array = map.get($portals, id); Direction_in = array[0]; Direction_out = array[1]; to_loc = array[2]; mid_loc = array[3]; player_loc = entity.getLocation(player); player_yaw = loc.getYaw(player_loc); if(Direction_in == "east"){ player_X = loc.getX(player_loc); mid_X = loc.getX(mid_loc); dif = mid_X - player_X; rel_yaw = player_yaw+90; } elseif(Direction_in == "south"){ player_Z = loc.getZ(player_loc); mid_Z = loc.getZ(mid_loc); dif = mid_Z - player_Z; rel_yaw = player_yaw; } if(Direction_out == "east"){ tp_loc = loc.mod(to_loc, 2*dif, 0, 0); rel_yaw += -90; } elseif(Direction_out == "south"){ tp_loc = loc.mod(to_loc, 0, 0, 2*dif); } elseif(Direction_out == "west"){ tp_loc = loc.mod(to_loc, -2*dif, 0, 0); rel_yaw += 90; } elseif(Direction_out == "north"){ tp_loc = loc.mod(to_loc, 0, 0, -2*dif); rel_yaw += 180; } if(rel_yaw > 180){ rel_yaw -= 360; }elseif(rel_yaw <= -180){ rel_yaw += 360; } loc.setYaw(tp_loc, rel_yaw); loc.setPitch(tp_loc, loc.getPitch(player_loc)); entity.teleport(player, tp_loc); }