Update Visibility of Several HUD Texts

I am trying to create a group of text the will show up as a Change Log for my gamemode. I want players to be able to disable it however because there is a lot of info that would cover the screen. There are several problems with what I have so far, so let me list them:

  • There are several Hud Text instances and I believe that they wouldn’t be able to be fit into one variable.
  • I do not know how to make it so that it toggles the Hud Text, not just destroy it.
  • I want to do it in an optimized way.

Here’s the code I currently have (using overPy)

rule "Change Log Text":
@Event eachPlayer
@Condition eventPlayer.hasSpawned() == true

hudText(eventPlayer, iconString(Icon.QUESTION_MARK), "Change Log", "Crouch + Interact to Toggle", HudPosition.LEFT, -4, Color.WHITE, Color.WHITE, Color.WHITE, HudReeval.VISIBILITY, SpecVisibility.DEFAULT)
eventPlayer.ChangeLogTextID = getLastCreatedText()

rule "Enable/Disable Change Log Visibility":
@Event eachPlayer
@Condition eventPlayer.isHoldingButton(Button.CROUCH)
@Condition eventPlayer.isHoldingButton(Button.INTERACT)

For toggling the HUD text’s visibility, use a variable (I will call it ChangeLogHidden), and in the actions of your “Enable/Disable Change Log Visibility” rule, add Event Player.ChangeLogHidden = !Event Player.ChangeLogHidden (This will switch the variable from False/Null to True, and from True to False). Make sure to include the exclamation point ! in that expression, it is the NOT operator, which will invert the boolean value it is behind.

Change the rule’s event to Global to create the HUD text, and set the Visible To parameter of the HUD text to Filtered Array(All Players(All Teams), !Current Array Element.ChangeLogHidden), which means it will show to all players except for those who have ChangeLogHidden set to true. This only takes one HUD text.

If you need me to create a working script please compile the OverPy code into normal Workshop code and post it. I am not good with OverPy code.

I am unable to make the rule global because I am using a playervar “ChangeLogHidden”

I can send it in workshop form,

rule ("Change Log Visibility") {
event {
    Ongoing - Each Player;
    All;
    All;
}
conditions {
    Is Game In Progress == True;
    Global.DisableGame != True;
}
actions {
    Wait(0.016, Ignore Condition);
    Create HUD Text(All Players(All Teams), Icon String(Question Mark), Custom String("Toggle with Crouch + Interact", Null, Null, Null), Custom String("Change Log v1.11.0", Null, Null, Null), Left, -4, Color(White), Color(White), Color(White), Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String(" ", Null, Null, Null), Null, Left, -3.5, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Null, Custom String("BALANCE CHANGES", Null, Null, Null), Left, -3, Null, Null, Color(White), Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Ana ultimate generation increased from -10% to -5%", Null, Null, Null), Null, Left, -2.9, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Ashe ultimate generation increased from -15% to -7.5%", Null, Null, Null), Null, Left, -2.8, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- D.Va ultimate generation increased from -20% to -10%", Null, Null, Null), Null, Left, -2.7, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Doomfist ultimate generation increased from -10% to -5%", Null, Null, Null), Null, Left, -2.6, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Genji ultimate generation increased from +10% to +15%", Null, Null, Null), Null, Left, -2.5, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String(" - Genji default charge decreased from  62.5 to 50", Null, Null, Null), Null, Left, -2.4, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String(" - Genji charge speed increased from 1.375 to 2.0", Null, Null, Null), Null, Left, -2.3, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Mei ultimate generation increased from -15% to -7.5%", Null, Null, Null), Null, Left, -2.2, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Mercy ultimate generation increased from -5% to -2.5%", Null, Null, Null), Null, Left, -2.1, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Reaper ultimate generation increased from -10% to -7.5%", Null, Null, Null), Null, Left, -2.09, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Roadhog ultimate generation increased from -10% to -7.5%", Null, Null, Null), Null, Left, -2.08, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Tracer ultimate generation increased from -10% to -5%", Null, Null, Null), Null, Left, -2.07, Null, Color(White), Null, Visible To, Default Visibility);
    Create HUD Text(Remove From Array(All Players(All Teams), (Event Player).ChangeLogHidden), Null, Custom String("- Echo ammunition clip size decreased from 12 to 6", Null, Null, Null), Null, Left, -2.06, Null, Color(White), Null, Visible To, Default Visibility);
}
}

You could have a global array of viewing players and add players that spawn to it. Player could remove himself from the array by pressing a button or something if he is in the array, or after a time.

1 Like