How it looks (for you/plural)
And a video link…This text will be hidden
How it works (for me)
UENUM()
enum class EDieType : uint8
{
Invalid = 0x0,
d2 = 0x2,
d3 = 0x3,
d4 = 0x4,
d6 = 0x6,
d8 = 0x8,
d10 = 0xA,
d12 = 0xC,
d20 = 0x14,
d100 = 0x64,
};
and
static FORCEINLINE int32 RollDice(EDieType DieType, int32 Roll = 1)
{
check(DieType!=EDieType::Invalid);
int32 dice = 0;
for (int i = 1; i <= Roll; ++i)
{
dice += rand() % static_cast<int>(DieType) + 1;
}
return dice;
}
Some extra info, no tl;dr
An average programmer, want to study some C++ in Unreal via a remake of sorts (KotOR in particular), so an omelet was one way, with random ingredients. Not an artist but I heard about projection matrices. Just added a shiny new DnD dice roll method.