Granting Weapons on Player Spawn in Verse
Now that you’ve balanced players into teams, you want to grant them the correct weapons based on what team they were balanced onto. Follow the steps below to learn how to grant players the appropriate weapons when they spawn.
Granting Weapons based on Team
-
In the
triad_infiltration_gameclass definition, add a new function namedGrantTeamWeapon(). This function grants a weapon to a player based on their respective team.GrantTeamWeapon(InPlayer:player):void= -
In
GrantTeamWeapon(), get the team for the given player. Then in aforloop, iterate through each team in theTeamsarray, getting the index for that team and storing it in a variableTeamIndex. Check if the given player’s team matches this team as a filter condition in yourforloop.| | | | --- | --- | | | GrantTeamWeapon(InPlayer:player):void= | | | if(CurrentTeam := GetPlayspace().GetTeamCollection().GetTeam[InPlayer]): | | | for(TeamIndex -> PlayerTeam:Teams, PlayerTeam = CurrentTeam): |GrantTeamWeapon(InPlayer:player):void= if(CurrentTeam := GetPlayspace().GetTeamCollection().GetTeam[InPlayer]): for(TeamIndex -> PlayerTeam:Teams, PlayerTeam = CurrentTeam):
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.