Freedom Reborn Archive

Freedom Force Forums => Scripting Forum => Topic started by: bearded on November 16, 2008, 01:15:23 PM

Title: random fx
Post by: bearded on November 16, 2008, 01:15:23 PM
would the ffx attribute mutator be capable of using the same name for a custom power, but the power actually being different in ffedit?
that way you could set up the same power, say "green_beam", but each version has a different fx.
Title: Re: random fx
Post by: Epimethee on November 16, 2008, 02:31:28 PM
Not as is. For any attack except area, you'd need a different power, as each power is hardwired to its FX. Either the power would be duplicated so mutator use a random variant from a list of acceptable variants each time, or the power would be rewritten on the fly using loadPower() (but you'd still need the variant list, so this second option is rather pointless).

For example, the ice beam power – existing code:
def mut_icebeam(target,char):
    Trigger_Power(char,target,'mut_icebeam','')

If we assume that the powers in powers.dat are always going to follow a specific naming pattern (here 'mut_icebeam', 'mut_icebeam2', 'mut_icebeam3' and so on until, say, 'mut_icebeam6'), the new code could be:
def mut_icebeam(target,char):
    power = 'mut_icebeam%s' % str( randint(0,6) )
    # this extra stuff is for compatibility with the existing name, which doesn't use numbers at the end
    # there is probably a more elegant solution than this
    if power[-1] == '0':
        power = power[:-1]   
    Trigger_Power(char, target, power, '')


You'll notice than I'm not proposing end-user customization through ffxcustom.py – the Control Centre interface can't really cope with the large number of options needed for the complete Mutator powerset; beside, the benefit would be quite limited.

As for area attacks, you could also use a no-FX power and trigger the effect programmatically.