Third Person Camera

2S23V

Play anything you want in Third Person.

Interact changes the side the camera is on.
Interact + Primary Fire zooms in the camera up to a maximum.
Interact + Secondary Fire zooms out the camera up to a maximum.

Widowmaker and Ashe can still use their scopes as they normally would.
The camera takes terrain in consideration and tries not to clip through walls.
It's super janky at times, but that's part of the charm!

By default the gamemode is set to Deathmatch, but you can adjust the lobby settings to whatever you want.

Code Snippet

settings { main { Description: "You're in Third Person. Play any mode you want. More at workshop.codes/third-person" } lobby { Allow Players Who Are In Queue: Yes Match Voice Chat: Enabled } modes { Deathmatch { Game Length In Minutes: 15 Score To Win: 50 disabled maps { Workshop Chamber Workshop Expanse Workshop Island } } General { Hero Limit: Off } } } variables { player: 0: Direction 1: Zoom } disabled rule("----- Made by Mitsiee. More at https://workshop.codes/third-person -----") { event { Ongoing - Global; } } rule("Initialise") { event { Ongoing - Each Player; All; All; } actions { Set Player Variable(Event Player, Direction, 1); Set Player Variable(Event Player, Zoom, -2.500); } } rule("Set Third Person") { event { Ongoing - Each Player; All; All; } conditions { Is Alive(Event Player) == True; And(Or(Compare(Hero Of(Event Player), ==, Hero(Widowmaker)), Compare(Hero Of(Event Player), ==, Hero(Ashe))), Is Button Held( Event Player, Secondary Fire)) != True; } actions { Start Camera(Event Player, Ray Cast Hit Position(Eye Position(Event Player), Add(Eye Position(Event Player), Add(World Vector Of( Vector(Multiply(Player Variable(Event Player, Direction), Min(Divide(Player Variable(Event Player, Zoom), 2.500), -0.750)), 0, 0), Event Player, Rotation), Multiply(Facing Direction Of(Event Player), Player Variable(Event Player, Zoom)))), All Players( All Teams), Event Player, False), Ray Cast Hit Position(Eye Position(Event Player), Add(Eye Position(Event Player), Multiply( Facing Direction Of(Event Player), 200)), All Players(All Teams), Event Player, False), 60); disabled Start Camera(Event Player, Ray Cast Hit Position(Eye Position(Event Player), Add(Eye Position(Event Player), Add(World Vector Of( Vector(Player Variable(Event Player, Direction), 0, 0), Event Player, Rotation), Multiply(Facing Direction Of(Event Player), Player Variable(Event Player, Zoom)))), All Players(All Teams), Event Player, False), Ray Cast Hit Position(Eye Position( Event Player), Add(Eye Position(Event Player), Multiply(Facing Direction Of(Event Player), 200)), All Players(All Teams), Event Player, False), 60); } } rule("Unset Third Person for specific conditions") { event { Ongoing - Each Player; All; All; } conditions { And(Or(Compare(Hero Of(Event Player), ==, Hero(Widowmaker)), Compare(Hero Of(Event Player), ==, Hero(Ashe))), Is Button Held( Event Player, Secondary Fire)) == True; } actions { Stop Camera(Event Player); } } disabled rule("----- Controls -----") { event { Ongoing - Global; } } rule("Pressing Interact") { event { Ongoing - Each Player; All; All; } conditions { Is Button Held(Event Player, Interact) == True; } actions { If(Compare(Player Variable(Event Player, Direction), ==, -1)); Set Player Variable(Event Player, Direction, 1); Else; Set Player Variable(Event Player, Direction, -1); End; } } rule("Zoom in") { event { Ongoing - Each Player; All; All; } conditions { Is Button Held(Event Player, Primary Fire) == True; Is Button Held(Event Player, Interact) == True; Is Button Held(Event Player, Secondary Fire) == False; } actions { Skip If(Compare(Player Variable(Event Player, Zoom), >=, -1), 1); Modify Player Variable(Event Player, Zoom, Add, 0.100); Wait(0.050, Ignore Condition); Loop If Condition Is True; } } rule("Zoom out") { event { Ongoing - Each Player; All; All; } conditions { Is Button Held(Event Player, Secondary Fire) == True; Is Button Held(Event Player, Interact) == True; Is Button Held(Event Player, Primary Fire) == False; } actions { Skip If(Compare(Player Variable(Event Player, Zoom), <=, -5), 1); Modify Player Variable(Event Player, Zoom, Subtract, 0.100); Wait(0.050, Ignore Condition); Loop If Condition Is True; } } disabled rule("----- UI -----") { event { Ongoing - Global; } } rule("Instructions") { event { Ongoing - Each Player; All; All; } actions { Create HUD Text(Event Player, Null, Player Variable(Event Player, Zoom), Null, Left, 0, White, White, White, Visible To and String, Default Visibility); Create HUD Text(Event Player, Null, Custom String("Current zoom level:", Null, Null, Null), Null, Left, 0, White, White, White, Visible To and String, Default Visibility); Create HUD Text(Event Player, Null, Custom String(" ", Null, Null, Null), Null, Left, 0, White, White, White, Visible To and String, Default Visibility); Create HUD Text(Event Player, Null, Custom String("Zoom out with [Interact] + [Secondary Fire]", Null, Null, Null), Null, Left, 0, White, White, White, Visible To and String, Default Visibility); Create HUD Text(Event Player, Null, Custom String("Zoom in with [Interact] + [Primary Fire]", Null, Null, Null), Null, Left, 0, White, White, White, Visible To and String, Default Visibility); Create HUD Text(Event Player, Null, Custom String("Swap the camera shoulder side with [Interact]", Null, Null, Null), Null, Left, 0, White, White, White, Visible To and String, Default Visibility); } }
View Fullscreen
Copy to clipboard

0 Comments

Log in or Sign up to place a comment.
Websites are expensive, support Workshop.codes
Workshop.codes - Background image