King of the Hill Game Logic

This package contains the basic game logic for a King of the Hill style game.

It was designed to work with the starter game templates and relies on the default gameController and scoreScript to control rounds and award points to players. It’s currently only been tested with the Free For All starter template but it should work with others as well. Of course, if you run into any issues, find me on the Crayta Discord and I’ll try to help.

Demo game: Stand Your Ground - FFA KotH

SETUP

  • Install the “King of the Hill Game Logic” package from the Community tab.
  • Place an instance of the “King of the Hill Locator” template somewhere in your world.
  • On your gameController entity, add the following events:
    • OnRoundStart - kingoftheHillLocator > hillControllerScript > StartSchedules
    • OnRoundEnd - kingoftheHillLocator > hillControllerScript > CancelSchedules
  • Configure the properties to suit your game.

CONFIG OPTIONS

All of the configuration options can be found on the King of the Hill Locator. They include the following properties:

  • Hill Triggers - An array of triggers that define the area that players must control.
  • Check Interval - The amount of time (in seconds) between checking if any players are within the defined Hill Triggers.
  • Score Interval - The amount of time (in seconds) between awarding points to a player if they are the only player within the Hill Triggers.
  • Points Per Interval - The amount of points to award each Score Interval.
  • Must Stay In Trigger - If true, a player must remain within the Hill Triggers in order to gain points.
  • Must Be Alive - If true, a player must remain alive in order to gain points.
  • Win By Score - If true, when a player reaches the Winning Score the On Winning Score events will fire.
  • Winning Score - The value of points a player must reach to fire the On Winning Score events.
  • Count Down To Zero - If true, all players will start with the Winning Score and the On Winning Score events will fire when a player reaches zero.
  • On Winning Score - Events to fire based on the Win By Score and Winning Score properties. For starter templates to end the round, this will likely need an event set to “gameController / gameScript / EndPlay”.
  • You Are King Msg - The message to display for the current king.
  • You Are Not King Msg - The message to display for the current king when they are no longer the king.
  • Someone Is King Msg - The message to display to all other players who are not the king. The message format is “[NAME] … message” so this message should start with a space.
  • Multiple Kings Msg - The message to display when multiple players are in the Hill Triggers.
  • No King Msg - The message to display when there are no players in the Hill Triggers.
  • Persistent No King Msg - If true, the No King Msg will always be visible to all players when no players are within the Hill Triggers.

UPDATE 01/14/22 - Added support for teams, and cycling through multiple triggers as see in the game: King of the Coast by BossLady101. Updates listed below.

New properties on the hillControllerScript:

  • Team King Msg - Only applicable if the game has teams (as defined by the gameController). This message will be displayed to all users using the team name defined on the gameController. The format will be ‘[TeamName] … teamKingMsg’ so your message should start with a space.
  • Team No King Msg - Only applicable if the game has teams (as defined by the gameController). This message will be displayed to all users when neither team has players on the Hill.
  • Team Multiple Kings Msg - Only applicable if the game has teams (as defined by the gameController). This message will be displayed to all users when both teams have players on the Hill.
  • New script

There is a new script called the triggerCycleScript. This allows the game to cycle through defined triggers to change the active “hill”. The properties include:

  • Hill Triggers - An array of all the hill triggers in your game to cycle through. Note: This array should match the array of Hill Triggers defined on the hillControllerScript.
  • Hill Change Duration - The amount of time (in seconds) between changing the active hill.
  • Active Trigger Indicator - A template to use an an indicator over the active hill. Note: This package comes with a template named “Active Trigger Indicator” if it’s not already defined in this property.
  • Z Offset - The distance above the active hill to show the indicator.

To set up the cycling active hills, add the triggerCycleScript to the entity that contains the hillControllerScript and configure the properties to fit your game.

And as always, a brief gif of the package in action:

2 Likes