MEDALDEF: Difference between revisions

From Zandronum Wiki
(Clarified that a "text colour" should be the name used for the colour in the TEXTCOLO lump.)
Tag: Source edit
(Added an example.)
Tag: Source edit
 
Line 42: Line 42:
*<code>'''Sound'''</code>
*<code>'''Sound'''</code>
The name of the sound to play when a player receives the medal. This sound only plays when the user isn't looking through the player's eyes.
The name of the sound to play when a player receives the medal. This sound only plays when the user isn't looking through the player's eyes.
=Example=
Ideally, you should define your own FloatyIcon class to use for your set of medals, rather than replace the native FloatyIcon class. Doing it this way ensures that your medals won't interfere with another mod's, and vice versa. For example, if we want to create a new "Single kill" medal, then we should add a DECORATE file with something like this in it:
Actor MyCustomFloatyIcon : FloatyIcon
{
    States
    {
        SingleKill:
            SING A -1
            Stop
    }
}
Our MEDALDEF lump would then have this in it:
SingleKill
{
    Icon = "SINGA0"
    Class = "MyCustomFloatyIcon"
    State = "SingleKill"
    Text = "Single kill!"
    TextColor = "Gold"
    QuantityColor = "Grey"
    AnnouncerEntry = "SingleKill"
}
When a player receives the "Single kill" medal, it will spawn a <code>MyCustomFloatyIcon</code> actor over their head and use the <code>SingleKill</code> state to show it.


[[Category:Special lumps]]
[[Category:Special lumps]]
[[Category: Zandronum-specific lumps]]
[[Category: Zandronum-specific lumps]]

Latest revision as of 14:59, 27 May 2024

This article documents a Zandronum-specific special lump which may not be supported by ZDoom and its other child ports.
This article documents a special lump which is only available in development builds of Zandronum 3.2 and newer.

(development version 3.2-alpha and above only) MEDALDEF is a special lump that allows mods to create their own medals, similar to the built-in Skulltag medals. Custom medals can be awarded to players using either GivePlayerMedal or A_GivePlayerMedal.

To create or edit a medal, the following syntax can be used:

MedalName
{
   AddFlag <flag>
   RemoveFlag <flag>

   Property = "<value>";
}

All values for properties must be enclosed in quotation marks.

Flags

  • KEEPBETWEENLEVELS

Players are allowed to keep the medal when the level changes.

  • ALWAYSSHOWQUANTITY

When a player receives the medal, the quantity and only one copy of the medal's icon will always appear on the screen.

Properties

  • Icon

The name of the graphic that appears on the screen when the medal is awarded to a player.

  • ScoreboardIcon

The name of the graphic used to show the medal on the scoreboard via the DrawMedals margin command. If left unspecified, or if the graphic doesn't exist, then the Icon is used instead.

  • Class

Which FloatyIcon actor class to spawn over the player's head when they receive the medal. This must be specified.

  • State

Which state in the FloatyIcon actor class to show over the player's head when they receive the medal. This must be specified.

  • Text

The text that appears on the screen when the medal is awarded to a player.

  • TextColor

The text colour (as defined in the TEXTCOLO lump) used to draw the text on the screen.

  • QuantityColor

The text colour used to draw how much of the medal a player has earned, if there's too many to fit all of them on the screen, or if the ALWAYSSHOWQUANTITY flag is enabled.

  • AnnouncerEntry

The announcer entry to play when a player receives the medal.

  • LowerMedal

If a player previously earned the specified "lower" medal and it's currently being shown over their head, then receiving this medal will instantly replace it.

  • Sound

The name of the sound to play when a player receives the medal. This sound only plays when the user isn't looking through the player's eyes.

Example

Ideally, you should define your own FloatyIcon class to use for your set of medals, rather than replace the native FloatyIcon class. Doing it this way ensures that your medals won't interfere with another mod's, and vice versa. For example, if we want to create a new "Single kill" medal, then we should add a DECORATE file with something like this in it:

Actor MyCustomFloatyIcon : FloatyIcon
{
   States
   {
       SingleKill:
           SING A -1
           Stop
   }
}

Our MEDALDEF lump would then have this in it:

SingleKill
{
   Icon = "SINGA0"
   Class = "MyCustomFloatyIcon"
   State = "SingleKill"
   Text = "Single kill!"
   TextColor = "Gold"
   QuantityColor = "Grey"
   AnnouncerEntry = "SingleKill"
}

When a player receives the "Single kill" medal, it will spawn a MyCustomFloatyIcon actor over their head and use the SingleKill state to show it.