TWH-Scripts
  • 👋Welcome!
  • About us
    • 🚀Vision, Mission & Focus
      • Vision
      • Mission
      • Focus
    • 💖Values
  • Team
    • 👋Meet the Team!
  • Collaborating
    • 🤝How we Work Together
  • Resources
    • 📄Script-Documentations
      • Addiction
      • Bankrob
      • BodyStatusText
      • Calendar-Rewards
      • Collect
      • Lumber & Mining Essentials
      • Collector's Conquest Bundle
        • Tradingcards
        • Boosterpacks
        • Tradingcard Upgrades
      • Custom Dates
      • Dispatch-System
      • Lawmen
      • Mapmarker
      • NPC-Guides
      • Oilcorp.
      • Processing
      • Promotion-Pass
      • Social-Level System
      • Social-Pass
      • Storage
    • 📂Open Source
    • 📝Useful Snippets and Info
      • Addiction and Metabolism
  • Services
    • 🛠️Custom Orders and Personalized Development Services
    • 📖Advanced Logging System
Powered by GitBook
On this page
  • Installation
  • Configuration
  • Card Configuration
  • Basic structure
  • Create a New Set
  • Advanced Cards
  • All available effects:
  1. Resources
  2. Script-Documentations
  3. Collector's Conquest Bundle

Tradingcards

Frameworks: VORP

PreviousCollector's Conquest BundleNextBoosterpacks

Last updated 1 year ago

twh_tradingcards script brings a unique and immersive trading card experience to your game environment and is part of the . It allows for extensive customization and interactive features, creating an engaging card collecting and trading experience.

Key Features:

  • View your cards in single view: This script allows you to view cards with metadata in your inventory in a more detailed view.

  • Add to Collection: You can add cards to your collection and view them in a beautifully designed scrapbook.

  • Custom Rarity and Set Reward: The script allows you to set as many rarities as you want for each set, with each rarity having its own set of rewards. Rewards can be items, currency or weapons.

  • Sort Cards: Cards can be sorted by set and rarity, making it easier for you to manage and view your collection.

  • Customize Cards: Each card can be individually customized as per your liking. You can also remove cards from the scrapbook with a simple right-click.

  • Beautiful and Clean UI: The user interface has been designed to be clean and visually appealing, enhancing the overall user experience.

Remember, any further development or customization outside of the base functionality is considered as a paid service, but updates to the script itself are, of course, free of charge.

Installation

Add following line to your server.cfg or ressource.cfg:

  • ensure twh_tradingcards

Configuration

There are 5 different important configuration files.

NUI:

  • html/build/data/config.json - config for card background and language selection

  • html/build/data/cards.json - configuration file for sets and cards (detailed documentation see below)

  • html/build/data/language.json - language file

Client Config:

  • config/config.lua - rewards, webhook, language selection

  • config/language.lua - language file

IMPORTANT! Some of the configuration files have to have the same values in order to work correctly. E.g. the names of Configs.rewards in config/config.lua have to be the same as the "set" attribute in html/build/data/cards.json. Also the numbers for rewards for the set in config/config.lua has to be the exact same numbers as raritiesNumbers in html/build/data/cards.json, which also has to have the same amount of entries as rarities and raritiesToCSSClasses.

Card Configuration

The Script contain multiple config files for various purposes. We now take a closer look on the cards.json. This file is used to configure the card sets and the card appearence as well as the actual card images and is found in html/build/data/cards.json.

Remember, you need to provide values based on your requirement. This JSON is highly configurable and can adapt to changes quickly. If you want to add a new card set, you can simply copy the structure and replace the values with the new set details.

Basic structure

This JSON file is a list of dictionaries, each representing a different card set. Here are the key fields for each card set:

  • set: This is the internal identifier of the card set. This helps the game engine to distinguish between different card sets.

  • setname: This is the name of the card set that will be displayed in the collection view.

  • rarities: This is a list of different rarities available for the cards in the set.

  • raritiesNumbers: These are numeric values representing each rarity level. The ordering of these numbers corresponds with the ordering of the rarities. So, 'common' corresponds to '1', 'uncommon' corresponds to '2', etc.

  • raritiesToCSSClasses: These are the names of the CSS classes used to style cards of different rarities. This list is also in the same order as 'rarities' and 'raritiesNumbers'.

  • cards: This is a dictionary of cards available in this set. Each card has a numeric key, which can be thought of as the card's internal identifier.

Each card in the "cards" dictionary has the following key fields:

  • cardname: The name of the card to be displayed in the collection view.

  • supertype and subtypes (for future use): Currently without function. These are classifications for the card. The supertype is the overall type, and subtypes are more specific classifications within that type.

  • images: This contains the path to the image file representing the card.

  • rarities (not to be confused with the set - rarities): This is a dictionary where each key is a rarity level, and the value is another dictionary that defines the images for the card at that rarity level. Here you can define how each card should look like in this rarity level.

Within each card, there is also a rarities section. This section specifies the different types of images that will be used based on the rarity of the card. Here you can set individual overlay images and special mask and foil images for each card rarity level.

Let's take a closer look at one of the cards in the "cities" set:

{
    "cardname": "Valentine",
    "supertype": "tradingcard",
    "subtypes": ["Basic"],
    "images": {
        "large": "img/set-cities-valentine.png"
    },
    "rarities": {
        "1": {
            "images": {
                "large": "img/set-cities-valentine.png",
                "overlay": "img/common1.png"
            }
        },
        "2": {
            "images": {
                "large": "img/set-cities-valentine.png",
                "overlay": "img/uncommon1.png"
            }
        },
        "4": {
            "images": {
                "large": "img/set-cities-valentine.png",
                "overlay": "img/signature_rr_1.png"
            }
        },
        "5": {
            "images": {
                "large": "img/set-cities-valentine.png",
                "mask": "../../img/ultrarare_mask.png"
            }
        }
    }
}

This card is called "Valentine" and it's a basic trading card. Its main image can be found at img/set-cities-valentine.png. Depending on its rarity, it has different overlay images (for example, img/common1.png - which is a semi-transparent "dirt" overlay - for common cards and img/signature_rr_1.png - which is a transparent layer with a signature - for rare cards). If it's an ultra-rare card, a special mask image (../../img/ultrarare_mask.png) will be used instead of an overlay.

img/common1.png

img/signature_rr_1.png

Create a New Set

Step 1: Understand the Structure

Before adding a new set, let's understand the structure of a set:

  • set: It's the identification code for the set. This must be unique. Player will never see this.

  • setname: It's the name of the set as it will be displayed in the collection and seen by players.

  • rarities: It's an array of different rarities that a card can have. These are the rarity identifies as used in e.g. language files to translate them. If you dont need more, keep them as some styles in the UI are hard coded to these names. If you need more or less rarity levels per set, just remove them. Make sure to also remove them from the next two variables as they have to be in sync.

  • raritiesNumbers: It's an array of numbers representing each rarity level. When removing or adding new rarity levels you need to sync it with rarities and raritiesToCSSClasses

  • raritiesToCSSClasses: It's an array of classes related to each rarity level. There is a fixed amount of different classes that you can use here. The available classes are: "Common", "Uncommon", "Rare Secret", "Rare Holo", "Rare Holo Cosmos", "Radiant Rare", "trainer gallery rare holo", "Rare Holo V", "Rare Rainbow", "Rare Holo VMAX", "Rare Holo VSTAR", "Amazing Rare", "Rare Shiny"

  • cards: It's an object that contains different cards. Each card has its properties such as cardname, supertype, subtypes, images, and rarities.

Step 2: Add a New Set

To add a new set, add a new object at the end of the JSON array:

, {
    "set": "newSet",
    "setname": "New Set",
    "rarities": ["common", "uncommon", "rare", "epic", "ultra-rare"],
    "raritiesNumbers": [1, 2, 3, 4, 5],
    "raritiesToCSSClasses": ["Common", "Uncommon", "Rare Shiny", "Rare Holo V", "Rare Rainbow"],
    "cards": {
        // Card details will be added here
    }
}

Step 3: Add Cards to the New Set

Inside the cards object, we can add our new cards. Each card is a new object inside cards with a unique identification code:

"cards": {
    "1": {
        "cardname": "New Card 1",
        "supertype": "tradingcard",
        "subtypes": ["Basic"],
        "images": {
            "large": "img/set-newset-newcard1.png"
        },
        "rarities": {
            // Rarity details will be added here
        }
    }
}

Step 4: Add Rarities to the New Cards

Each card can have different rarities. Each rarity is represented by a new object inside rarities with a unique identification number. You just have to define individual rarities per card if you want the card rarity level to have a different overlay or mask or foil.

"rarities": {
    "1": {
        "images": {
            "large": "img/set-newset-newcard1.png",
            "overlay": "img/common1.png"
        }
    },
    "2": {
        "images": {
            "large": "img/set-newset-newcard1.png",
            "overlay": "img/uncommon1.png"
        }
    },
    // And so on for other rarities
}

You could use more cards, but the UI is optimized for 5 cards per set. More rarities are possible but you may also encounter problems when using much more because of UI limitations.

Step 5: Save Changes

After adding your set, cards, and rarities, save the changes. Make sure the JSON structure is valid. Errors in you cards.json can have also impact on other scripts, as twh_boosterpacks and twh_tradingcardUpgrades are also using this file.

And that's it! You have added a new set of cards to the JSON file. The same procedure can be used to add more cards to the existing sets, just make sure the cards ID and rarities ID you are using are unique.

Advanced Cards

In the following section we will talk about more advanced options and customizations you can do with the cards config in twh_tradingcards.

We also offer payed service to create your mask and foil images for you cards. You can only pick from the available styles, but we can personalize it with your custom logo other other geometrical elements. Just open a ticket on our Discord and we can talk about your personalizations.

The "rarities" Object

The rarities object has multiple inner objects numbered from 1 to 5. These numbers match the raritiesNumbers from the card set.

Each number object contains an images object that describes the images associated with the card's rarity. There are different types of images: large, overlay, mask, and foil. Not every card contains all these image types.

Here's what each one means:

  • large: Path to the main image of the card. In most cases, this image is the same for every rarity level.

  • overlay: Path to an image that is displayed on top of the main image, giving it a visual representation of its rarity.

  • mask: Path to an image that is used as a mask for the main image to make some areas not affected by the foil or the effect. Can also used to make the effects less dominant (opacity).

  • foil: Path to a foil texture that can extra effects on cards.

Making a individual card with special shiny/holo effects

Making use of the shiny / holo card effect to make a card even more individual can be easily done with a mix of a mask and foil texture. Here are some examples to show you what they do.

Card with a mapped raritiesToCSSClasses of "Rare Rainbow" without any foil or mask

When not using a mask or foil, some effects are applying a default foil onto it.

Card with a mapped raritiesToCSSClasses of "Rare Rainbow" without a mask applied

A mask will remove the shiny or holo effect from parts of the map or reduces the effect.

All available effects:

The base effects are from a Pokemon project, so the effects are the same as known from the Pokemon trading cards game. "Common", "Uncommon", "Rare Secret", "Radiant Rare", "Rare Holo V", "Rare Holo VMAX", "Rare Holo VSTAR", "Rare Rainbow", "Amazing Rare"

We also offer payed service to slightly change effects e.g. colors. Just open a ticket on our Discord and we can talk about your individual whishes.

Common and Uncommon are "normal" cards without any effect. Best used for overlay effects which makes them "dirty".

Rare Secret

Radiant Rare

Rare Holo V

Rare Holo VMAX

Rare Holo VSTAR

Rare Rainbow

Rare Rainbow Alt

Amazing Rare


This software includes code licensed under the GNU General Public License (GPL). The full text of the license can be found in the LICENSE file included within the GPL parts of the software.

📄
Collector's Conquest Bundle
TWH-Scripts | Collectors Conquest Bundle
Logo