Created
June 19, 2025 21:20
-
-
Save VerseDev2/0fb3ef0887ad94b4855f832a8bebc0b4 to your computer and use it in GitHub Desktop.
Ultimate Loadout Voting System for Fortnite Creators - Elevate your Fortnite creative maps with the Ultimate Loadout Voting System! This robust device allows players to vote on their preferred loadouts in a seamless and engaging way. With customizable columns, voting times, and UI settings, you can tailor the experience to fit any game mode. The…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using { /Fortnite.com/Characters } | |
using { /Fortnite.com/Devices } | |
using { /Fortnite.com/Game } | |
using { /Fortnite.com/UI } | |
using { /Verse.org/Simulation } | |
using { /Verse.org/Random } | |
using { /Verse.org/Assets } | |
using { /Verse.org/Colors } | |
using { /UnrealEngine.com/Temporary/SpatialMath } | |
using { /UnrealEngine.com/Temporary/Diagnostics } | |
using { /UnrealEngine.com/Temporary/UI } | |
StringToText<localizes>(String : string) : message = "{String}" | |
loadout_vote_selection_device := class(creative_device): | |
@editable StartTrigger : trigger_device = trigger_device{} | |
@editable Columns : type{_X : int where _X > 1, _X < 6} = 3 | |
@editable VotingTime : type{ _X : int where _X >= 1, _X <= 30} = 10 | |
@editable Loadouts : []loadout = array{} | |
@editable UISettings : ui_settings = ui_settings{} | |
var LoadoutToCurrentVotes : [loadout]int = map{} | |
var MaxVotes : int = 0 | |
var CurrentVotes : int = 0 | |
var ImageSize : vector2 = vector2{} | |
var RowsToUse : int = 1 | |
# PUT YOUR TEXTURES HERE, IN THE ORDER OF LAYOUT!! :D | |
Textures : []texture = array: | |
VoteEndedEvent<private> : event() = event(){} # Signaled when voting period has ended | |
PlayerSelectionEvent<private> : event(button_selection_result) = event(button_selection_result){} # Signaled when player has made their selection | |
OnBegin<override>()<suspends> : void = | |
loop: | |
StartTrigger.TriggeredEvent.Await() | |
InitLoadoutSelection(GetPlayspace().GetPlayers()) | |
# Call this to begin the loadout selection phase | |
InitLoadoutSelection<public>(Players : []player)<suspends> : void = | |
Sleep(0.0) | |
set RowsToUse = Ceil[1.0 * Loadouts.Length / (1.0 * Columns)] or 4 | |
set ImageSize = (560.0 / (1.0 * RowsToUse)) * vector2{ X := 1.0, Y := 1.0} | |
set MaxVotes = Players.Length | |
set CurrentVotes = 0 | |
for (Loadout : Loadouts, set LoadoutToCurrentVotes[Loadout] = 0) {} | |
for ( Player : Players): | |
spawn{ PresentSelectionUI(Player) } | |
VoteEndedEvent.Await() | |
WinningLoadout := CalculateMostVotedLoadout() | |
for ( Player : Players): | |
WinningLoadout.ItemGranter.GrantItem(Player) | |
# Present the Loadout UI voting screen to a player | |
PresentSelectionUI<private>(Player : player)<suspends> : void = | |
var SelectionButtons : []button_loud = array{} | |
# Create our selection buttons with the respective loadout name | |
for ( Loadout : Loadouts): | |
set SelectionButtons += array: | |
button_loud: | |
DefaultText := StringToText("0") | |
if ( PlayerUI := GetPlayerUI[Player]): | |
╔════════════════════════════════════════════════╗ | |
║ Want the complete code? can be found on crayda ║ | |
╚════════════════════════════════════════════════╝ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment