This tutorial will demonstrate how to add a new card to Rance X with a custom CG and skills.
Start by downloading this .zip file which contains the code templates and directory structure for this mod project, plus a few scripts to automate the build process. Extract the .zip file somewhere, and then copy the files Rance10.ain
and Rance10EX.ex
from your game directory into the project directory (the same directory as the file extract.bat
). Then double click extract.bat
to dump the contents of the .ex file into the ex
directory (on *nix, run the script extract.sh instead).
Inside of the png
directory you’ll find an image file named カード/akuji.png
which will be used for our card. You can add more images into this folder to use for additional cards, just make sure that the images have the same dimensions as カード/akuji.png
and that the name begins with the カード/
prefix.
Open the file ex/8_カードデータ.x
in a text editor. The first line in the table gives the names and types of the columns (formatted vertically here for readability):
{
indexed string Id, // unique ID for the card, and the name that appears in game
string 識別名, // the character's name
string CG名, // name of the CG *without* the "カード/" prefix
int 所属, // the faction the card belongs to
int 属性, // attribute (fire, ice, etc.)
int 性別, // gender (1 = male, 2 = female)
int スキル1, // ID of the first skill
int スキル2, // ID of the second skill
int HP, // hit points
int ATK, // attack
int 種別, // ?
string 詳細CG, // CG to use for details page (when you first get the card)
int イベント種別, // ?
int 大人子供, // adult or child (adult = 0, child = 1)
int 裸, // nude (0 = normal, 2 = nude)
int SR, // card rarity?
int 削除, // ?
int 発生, // ?
int 情報時カード表示, // ?
int 割り込みバトル倍率, // ?
int 必殺連撃効果 // ?
},
To add a new card, we need to add a new row to this table. In this tutorial, we’re going to add a card to the JAPAN faction with the same stats as the default Rance card and (superficially) different skills. So we copy the line beginning with “Lv42 ランス” and change it like so:
{ "Lv42 ランス", "ランス", "ランス/基本", 1, 0, 1, 1004, 1008, 50, 42, 0, "立ち/ランス/基本", 0, 0, 0, 87, 0, 1, 0, 2, 0 },
{ "Yamamoto Akuji", "Akuji", "akuji", 6, 0, 1, 2500, 2501, 50, 42, 0, "", 0, 0, 0, 87, 0, 1, 0, 2, 0 },
png
directory, minus the “カード/” prefix and the file extensionOpen the file 11_スキルデータ.x
. This file contains a table with the data for every skill in the game. We will be adding two new rows by copying the skills used by the default Rance card:
{ 1004, "突撃-零-", 1, 3, "", 0, 100, 1, 100, 0, 0, 0, 0, "", 0, 0, "攻撃(1倍)" },
{ 2500, "Akuji Kick", 1, 3, "", 0, 100, 1, 100, 0, 0, 0, 0, "", 0, 0, "攻撃(1倍)" },
{ 1008, "ランスアタック", 1, 3, "", 3, 100, 1, 300, 7, 0, 0, 0, "", 1, 0, "攻撃(3倍)r 必中" },
{ 2501, "Akuji Punch", 1, 3, "", 3, 100, 1, 300, 7, 0, 0, 0, "", 1, 0, "攻撃(3倍)r 必中" },
Note that the numbers 2500 and 2501 match the numbers that we used in the row for our new card above. Other than that nothing has been changed about these skills.
In the file mod.jaf
you’ll find the following code,
This gives our new card to the player at the start of the game. For testing purposes, this is useful but you’ll probably want to remove this in a real mod.
Getting the card to show up in chests is a bit more complicated, but I’ve already done the hard part for you. If you open up the file mod.jam, towards the bottom you’ll find the following code,
;; MOD STARTS HERE
PUSHLOCALPAGE
PUSH 8
.LOCALREF カードBOX
.LOCALREF aa
.LOCALREF fg
CALLFUNC gacha_add_extra_cards
ASSIGN
POP
;; MOD ENDS HERE
This calls the function gacha_add_extra_cards
(defined in mod.jaf
), passing a reference to the array カードBOX
(the gacha pool) so that we can write the code to add our card to the pool in a high level language. In mod.jaf
you’ll find the following definition,
int gacha_add_extra_cards(ref array<string> cards, int nr_cards, int fg)
{
string v;
v = "Yamamoto Akuji";
if (TA7(10, fg, v, "", "", 0) == 1) {
nr_cards++;
cards[nr_cards] = v;
}
return nr_cards;
}
The chunk of code in the middle of the function can be copy+pasted for each card you want to add to the pool. Just make sure to change the arguments to the TA7
function to suit the card.
The function TA7 has the following prototype:
▲ランク
is the card rarity rank. You should set this to 0 (common), 10 (rare) or 20 (ultra rare) in most cases. Other possible values are 4/14 (for scripted drops) and 9/19 (prevents the card from dropping as a duplicate).▲箱
is the chest level. 0 means a common chest, 1 means a rare chest. You should pass the the variable fg
for this argument.v
is the name of the card. You should pass the variable v
for this argument.識別名
is the character requirement. For example, if you want to add variant cards which require the player to first collect the base card, you would pass the name of the character for this argument.条件
is the star rank requirement. It can be one of three values: “★20”, “★40” or “★80”. If this argument is not "", then the character named in the 識別名
argument must be at that star rank before the card will drop.▲フラグ
can be 0, 1 or 2. Most of the time you should pass 0. If you’re adding a nude card, you should pass 2. A value of 1 prevents the card from dropping before turn 11.Double click the file build.bat
to build the project (on *nix, run the script build.sh instead). This will create 3 files in the out
directory,
out/Rance10.ain
out/Rance10CGmod.afa
out/Rance10EX.ex
Copy these files into your game directory to install the mod.
That’s it. If you launch the game and start a new game, you should find your Akuji card in the JAPAN faction.