The idea was to make a function that randomly chooses which one to use. I was trying RandomF with IntSelect but it can only choose between functiosn that return “number”.
Let’s say I have this function:
using BLASTFADE_SIZE = Scale<
EffectRandomF<EFFECT_BLAST>,
Int<28000>,
Int<8000>
>;
This is where I’d want to put in a random selection in place of “EffectRandomF<EFFECT_BLAST>,”, where it could also choose BladeAngle<> or TwistAngle<> instead, for instance.
Which is used as a Size (or position) value for a Blast effect:
template<class POS = EffectPosition<EFFECT_BLAST>, class SIZE = BLASTFADE_SIZE<>>
using Blast_Fade = TrConcat<
TrInstant,
AlphaMixL<
Bump<
POS,
SIZE
>,
RgbArg<BLAST_COLOR_ARG, Rgb<127, 127, 127>>,
Mix<Int<16384>, Black, RgbArg<BLAST_COLOR_ARG, Rgb<127, 127, 127>>>
>,
TrFade<300>
>;
So, I still end up having in my style code 20 blast effects, which are all copies of 3 sections of code:
// Random Positions based on EffectPosition
// Blast Fade Random
Blast_Fade<BLASTPOS_SCALE<>, BLASTFADE_SIZE<>>,
// Blast Fade Sound
Blast_Fade<BLASTPOS_SCALE<>, BLASTFADE_SIZE<WavLen<EFFECT_BLAST>>>,
// Blast Wave Random
Blast_Wave<BLASTWAVE_SCALE<>, BLASTWAVE_SCALE<SlowNoise<Int<3000>>>, BLASTWAVE_SCALE<>, BLASTPOS_SCALE<>>,
// Blast Wave Sound
Blast_Wave<BLASTWAVE_SCALE<WavLen<EFFECT_BLAST>>, BLASTWAVE_SCALE<SlowNoise<Int<3000>>>, BLASTWAVE_SCALE<WavLen<EFFECT_BLAST>>, BLASTPOS_SCALE<>>,
// Blast Ripple Fade
Blast_Ripple_Fade<BLASTRIPPLE_POS<>, Int<6000>, Int<320000>>,
// Responsive Blast Fade Random
Blast_Fade<BLASTPOS_SCALE<BladeAngle<>>, BLASTFADE_SIZE<>>,
// Responsive Blast Fade Sound
Blast_Fade<BLASTPOS_SCALE<BladeAngle<>>, WavLen<EFFECT_BLAST>>,
// Responsive Blast Wave Random
Blast_Wave<BLASTWAVE_SCALE<>, BLASTWAVE_SCALE<SlowNoise<Int<3000>>>, BLASTWAVE_SCALE<>, BLASTPOS_SCALE<BladeAngle<>>>,
// Responsive Blast Wave Sound
Blast_Wave<BLASTWAVE_SCALE<WavLen<EFFECT_BLAST>>, BLASTWAVE_SCALE<SlowNoise<Int<3000>>>, BLASTWAVE_SCALE<WavLen<EFFECT_BLAST>>, BLASTPOS_SCALE<BladeAngle<>>>,
// Responsive Blast Ripple Fade
Blast_Ripple_Fade<BLASTRIPPLE_POS<BladeAngle<>>, Int<6000>, Int<320000>>,
// Responsive based on SwingSpeed<>
// Responsive Blast Fade Random
Blast_Fade<BLASTPOS_SCALE<SwingSpeed<200>>, BLASTFADE_SIZE<>>,
// Responsive Blast Fade Sound
Blast_Fade<BLASTPOS_SCALE<SwingSpeed<200>>, WavLen<EFFECT_BLAST>>,
// Responsive Blast Wave Random
Blast_Wave<BLASTWAVE_SCALE<>, BLASTWAVE_SCALE<SlowNoise<Int<3000>>>, BLASTWAVE_SCALE<>, BLASTPOS_SCALE<SwingSpeed<200>>>,
// Responsive Blast Wave Sound
Blast_Wave<BLASTWAVE_SCALE<WavLen<EFFECT_BLAST>>, BLASTWAVE_SCALE<SlowNoise<Int<3000>>>, BLASTWAVE_SCALE<WavLen<EFFECT_BLAST>>, BLASTPOS_SCALE<SwingSpeed<200>>>,
// Responsive Blast Ripple Fade
Blast_Ripple_Fade<BLASTRIPPLE_POS<SwingSpeed<200>>, Int<6000>, Int<320000>>,
// Responsive based on TwistAngle<>
// Responsive Blast Fade Random
Blast_Fade<BLASTPOS_SCALE<TwistAngle<>>, BLASTFADE_SIZE<>>,
// Responsive Blast Fade Sound
Blast_Fade<BLASTPOS_SCALE<TwistAngle<>>, WavLen<EFFECT_BLAST>>,
// Responsive Blast Wave Random
Blast_Wave<BLASTWAVE_SCALE<>, BLASTWAVE_SCALE<SlowNoise<Int<3000>>>, BLASTWAVE_SCALE<>, BLASTPOS_SCALE<TwistAngle<>>>,
// Responsive Blast Wave Sound
Blast_Wave<BLASTWAVE_SCALE<WavLen<EFFECT_BLAST>>, BLASTWAVE_SCALE<SlowNoise<Int<3000>>>, BLASTWAVE_SCALE<WavLen<EFFECT_BLAST>>, BLASTPOS_SCALE<TwistAngle<>>>,
// Responsive Blast Ripple Fade
Blast_Ripple_Fade<BLASTRIPPLE_POS<TwistAngle<>>, Int<6000>, Int<320000>>[/code]
Aaaand that’s what i’ve been up to today, taking all the Blast effects from the StyleBuilder, studying them, realizing they’re all variations of the same 3 functions, except for what method is used in Scale<>, and making 3 template functions to use for them all.
Now if only I could get it to randomly select which item to use in said Scale functions each time EFFECT_BLAST triggers, I could make those 20 functions only 3 functions, and greatly reduce the amount of code on memory.