Team Elimination 7 Testing Multiplayer Using the Sentry Device in Verse
Testing multiplayer game modes can be difficult due to the number of players involved, and you might not always have other people to play with. For this game mode, you can test eliminations in a single-player environment by using sentry devices. Because sentries have an EliminatedEvent you can subscribe to, they can act as enemy players for the purposes of testing your elimination code.
Follow these steps to grant weapons to players when they score an elimination on a sentry.
-
Add a new method
TestPlayerEliminatedto theteam_elimination_gameclass. This is called whenever a sentry is eliminated.| | | | --- | --- | | | TestPlayerEliminated(Agent : ?agent) : void = | | | Print("Sentry Down!") |TestPlayerEliminated(Agent : ?agent) : void = Print("Sentry Down!")
Copy full snippet(2 lines long)
-
In
TestPlayerEliminated, check if the Sentry was eliminated by a player, and if it was, pass the eliminating player toGiveNextWeapon. BecauseTestPlayerEliminatedalready accepts an agent option as an argument, you know implicitly which player scored this elimination.| | | | --- | --- | | | TestPlayerEliminated(Agent: ?agent) : void = | | | Print("Sentry Down!") | | | if(TeamPlayer := Agent?): | | | GiveNextWeapon(TeamPlayer) |
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.