Configuration
Adding new maps
In order to add a new map into the map, you must first construct the map. The map must consist of 2 spawn points, one for each team, and a ground for the player to stand on.
It is important to note that each spawn point must be renamed for easier identification and the Team value must be set to 4.
Next, navigate to the Global Script as so:
In here, you can find the location to add new map. Through the Init function in the Global Script, you can find where you can use the AddMap function.
To briefly explain the paramaters of the AddMap function:
- MapName: define the name of the new map (Must be unique)
- SpawnPointT1: define the spawn point entity of team 1
- SpawnPointT2: define the spawn point entity of team 2
The name of the map can be any text you want. The spawn point must be chosen and input correctly. An example of which can be seen from the set of images below.
Click on the eyedropper to choose the corresponding map’s spawn points.
The final result should be similar to this.
That concluded the logic section of adding in new maps to the pool. You can decorate the map as much as you want to construct the map of your dream.
Configuring Unlimited Gloo Walls
Configuring whether the map has Unlimited Gloo Wall is very simple.
First, navigate to Setting, then Gameplay Settings, then simply toggle the Unlimited Gloo Walls option to turn on or off the feature.
Configuring Headshot Only and Dropping Item on Elimination.
In order to toggle Headsho Only and Dropping Item on Elimination, navigate to Setting, then Gameplay Settings, then Edit Gameplay Rules.
Fron there, navigate to the Property Settings to find the Headshot Only and Is Drop item option.
Adjust these features as you wish to turn on or off these features.
Script Explanation
All logic of the project can be found in the Global and Player entity.
Global script
The logic of the entire map revolves around the 2 main events: On Game Start
and On Round Start
. The main function of this script is to correctly distribute players between each spawn point, randomizing maps and configure new map to add to the game.
On Game Start
When game start, the map must be initialized. This is done through the Init
function.
This function is also where users can add map through the
AddMap
functions.
This function works by adding a tag to each map’s spawn points. This map is inputed through the MapName
parameter. All spawn points would then be added to the spawn point lists to be used later.
As such, each map name must be unique in order for the system to work as intended.
On Round Start
Every round a new map must be chosen. The game entity must first choose a map name (MapTag) from a pool of maps in the ChooseRandomMap
function.
The tag would then be registered as a used map. If the the number of items in the list of used tag exceed the number of items in the total tag list, the used tag list would be reset.
The player’s spawn points would then be determined using the same tag. Specifically, the spawn point of team 1 and team 2 would be registered for later usage.
Player script
The player script is mainly responsible for the Headshot Only logic, Unlimited GlooWall logic, Equipment, and User Interface
On Awake
Starting with when player is first created, some functions are executed immediately.
First on the list is the Init
function. This function turn on invincibility for player in the Lobby and register the player’s team ID for futher usage.
SetPlayerSetting
is a function that is used for configuring the players, preventing them from dropping items when eliminated and the Headshot Only logic for player. The headshot only is achieved through setting the player’s Damage Taken Percentage value to an extremely small value, practically nullifying any damage to the player. Since we want to damage the player through headshot, we must adjust the player’s Headshot Damage Reduction by the same amount to counteract the effect of the Damage Taken Percentage.
Next, InitEquipment
will add GlooWall into the player’s inventory. If Unlimited Gloo Wall option is not turned on in the setting, this Gloo Would still be available in player’s inventory. Remove this if needed.
To reduce confusion for when player is being in the lobby, a notification is created through the CreateStartNoti
function.
On Round Start
When a new round start, the player would be teleported to the corresponding map and their UI will be adjusted.
As the name suggested, TPToSpawn
will teleport the player to the correct spawn point that was obtained through the Global script.
The CreateHSOnlyNoti
will then notify player if the currently mode is Headshot Only or not. If the map is configed to be normal, then this notification will not appear.
At the same time, the notification created from the Lobby must be deleted.
On Equip Weapon
From this event, an important logic for the Headshot Only mode is applied for weapon.
Normally, if only the player’s Headshot Damage Reduction and Damage Taken Percentage are adjusted, the Headshot damage will only amount to 1 to 5 damage per shot. As such the weapon’s Head Damage Factor needs to 55000 specifically to closely match the weapon’s original headshot damage. This value can be adjusted if a different damage value is desired.
On Phase End
The sole purpose of this event is to delete the player’s Headshot Only Notification at the end of the combat phase.
On User Quit or User Match End
This event is for ensuring that the HUD are deleted correctly when the match ends.