Secondcolor for Kart Characters

[Open Assets] Secondcolor for Kart Characters v1.4

This content may be freely modified and/or maintained by anyone.

Lach

he/him
Moderator
Sonic Team Junior
Kart Krew™️
Judge
This script lets character creators give their characters changeable secondary colors!

attachment.php


The instructions for usage are included in the script itself. Simply drag the script into your WAD or PK3 as a new lump and start reading!

I've done my best to make the process as easy as possible—all you need to do to get this working is import a separate set of sprites to overlay your character, then type into the script the name of your character, the name of the extra spriteset, and the list of secondcolors that you want your character to use. There are a number of extra options too, such as the ability to turn the secondcolor overlay off for certain colors, or set a default secondcolor!

When actually playing as a character that makes use of this script, the console command secondcolor can be used to choose a custom secondcolor! Not only does this let players come up with their own unique combinations during play, it makes choosing a character's color combinations a lot easier for their creators. (Of course, there are splitscreen variants of the command too! Unfortunately they're only usable in offline mode.) Creators, you can turn this feature off for your character, if you would rather players didn't mess with your selections.

If the setup process is somehow still confusing, I've included an example addon for creators to view (kl_secondcolorexample_v1.pk3). Adding this file in-game lets Eggman's cape change color.

Keep in mind that adding Lua scripts to your character disables Record Attack mode when they are added to the game!! If you would like your character to be usable in Record Attack, release a separate version without the script.

Known Issues:
  • In SRB2 Kart 1.0.4, the Lua function that determines opposite colors is currently bugged for the colors between and including Purple and Lilac. The issue is purely aesthetic and will be patched out in the next release of SRB2 Kart.
Please note that the script itself is NOT a standalone addon, it is for creators to use to add secondcolor functionality to their characters.
 

Attachments

  • kart0038.gif
    kart0038.gif
    7 MB · Views: 12,906
  • kart0038.gif
    kart0038.gif
    7 MB · Views: 6,209
  • kart0037.gif
    kart0037.gif
    6 MB · Views: 933
  • kart0037.gif
    kart0037.gif
    6 MB · Views: 748
  • ezgif-5-55d675a1137d.gif
    ezgif-5-55d675a1137d.gif
    5.2 MB · Views: 1,056
  • ezgif-5-55d675a1137d.gif
    ezgif-5-55d675a1137d.gif
    5.2 MB · Views: 1,148
  • LUA_SECN_v1.4.lua
    10.9 KB · Views: 633
  • kl_secondcolorexample_v2.pk3
    34.3 KB · Views: 596
Last edited:
Any reason why the splitscreen secondcolor still isn't available for online gameplay?

As far as I know, there is no way to determine which splitscreen players are playing from the same node in a netgame.
 
Would using the value of "splitscreen" (nil, 1, 2 or 3) work, like this?


Code:
    COM_AddCommand("secondcolor", function(player, arg)
            setSecondColor(player, arg)
        end)    
    
    for i = 4, 2, -1
        local s = i - 1 and i or ""
        COM_AddCommand("secondcolor"..s, function(player, arg)
            if splitscreen >= (s-1)
              setSecondColor(players[#player+s-1], arg)
            end
        end)
    end
 
Code:
setSecondColor(players[#player+s-1], arg)

I do not believe this method is reliable under the assumption that players joining a netgame always take the first available index in the array. Let's say that 5 players are playing in a netgame. If the 3rd one leaves, there's an open slot in the 3rd index. Then if someone joins with 4 splitscreen players, the first player probably takes that 3rd slot, and then the rest of the party takes the 6th, 7th, and 8th slots.

Code:
0: Player 1
1: Player 2
2: Client's splitscreen player 1
3: Player 4
4: Player 5
5: Client's splitscreen player 2
6: Client's splitscreen player 3
7: Client's splitscreen player 4
 
Updated script version to 1.4. This should fix an issue where the signpost sprites sometimes did not appear.
 
When using the FKart frame interpolation the recolor layer seems to get misaligned.


og5ktWU.png


I disabled frame interpolation and the recolor sprite works as intended. Am wondering if a fix could be possible.
 
Last edited:
I've found out exactly what edits need to be made to make it compatible with interpolation builds, like fkart or birdhouse.

-overlay.momx, overlay.momy, and overlay.momz should be set to mo.momx, mo.momy, mo.momz respectively instead of being set to 0 (around line 210).
-pmomz should also probably be taken into account
 
I doubt that anyone is really interested in this, but I've experimented a way to make secondcolor[2,3,4] commands work in netgame splitscreen.

A while back, I wrote “PartyChecker”, a workaround script to allow the server to know which players are in a splitscreen party: https://github.com/AlexPoilrouge/SRB2Kart_mod_and_misc/tree/master/scripts/PartyChecker

I just tried tweaking LUA_SECN_v1.4.lua (see attachment) to make secondColor work with the PartyChecker script.

However, in order for it to work in a splitscreen netgame, KL_PartyChecker_utils-1.2.lua needs to loaded before the secondColor lua script.
 

Attachments

  • LUA_SECN_v1.4-netSplitscreen.r001.lua
    12.3 KB · Views: 119

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top