Freedom Reborn

Freedom Force Forums => Scripting Forum => Topic started by: blackjacket on June 11, 2010, 02:42:14 AM

Title: Customized boost powers
Post by: blackjacket on June 11, 2010, 02:42:14 AM
Hey, sharing another power script..  I made custom boosts fo a bunch of characters using custom state swaps.  Made one for juggernaut called path of destruction (inspired of course by x-men legends 2):

in ffx2.py:

################################## JUGGERNAUT #####################################

def displacetopathdestruction(event):
   char=event.object
   POD=ffx.FFX_ObjectGetAttr(char,'pod')
   if POD==0:
      Object_SetGenericState(char,OBJSTATE_ATTACKBONUS,10000,0)
      bonus=0.0+Object_GetAttr(char,'attackBonus')
      Object_SetAttr(char,'attackBonus',bonus+1)
      ffx.FFX_SetMassFactor(char,20)
      ffx.FFX_ObjectSetAttr(char,'pod',1)
      ffx.FFX_ObjectSetAttr(char,'foot',1)
      ffx.RegTimer('footUpdate',0.5,0,char)
      ffx.RegTimer('removespeeddecrease',0.5,0,char)
      ffx.RegTimer('removePOD',10,0,char)

def removespeeddecrease(event):
   char=event.object
   if not Object_Exists(char):
      return
   POD=ffx.FFX_ObjectGetAttr(char,'pod')
   if POD==1:
      Object_SetSecondaryState(char,SCSTATE_SPEED_DECREASED,0,REMOVE_STATE)
      ffx.RegTimer('removespeeddecrease',0.5,0,char)

def removePOD(event):
   char=event.object
   if not Object_Exists(char):
      return
   POD=ffx.FFX_ObjectGetAttr(char,'pod')
   if POD==1:
      bonus=0.0+Object_GetAttr(char,'attackBonus')
      Object_SetAttr(char,'attackBonus',bonus-1)
      Object_SetGenericState(char,OBJSTATE_ATTACKBONUS,0,REMOVE_STATE)
      ffx.FFX_SetMassFactor(char,1)
      ffx.FFX_ObjectSetAttr(char,'pod',0)
      ffx.FFX_ObjectSetAttr(char,'foot',0)

also had to do the ffxcustom.py thing in ffx_carriers:
["juggernaut","displace","pathdestruction","JUG Path Of Destruction"],


plus:  had to prepare the heavyfooted portion:
def initfoot(char,update=0):
   if update==0:
      pos=Get_ObjectPos(char)
      ffx.FFX_ObjectSetAttr(char,'lastY',pos[1])
      ffx.FFX_ObjectSetAttr(char,'lastX',pos[0])

def footUpdate(event):
    char=event.object
    foot=FFX_ObjectGetAttr(char,'foot')
    if getByTemplate(char,FFX_HEAVYFOOTED_CUSTOM,3)==0: ### updated to check for flying customization 02/10/07-TMX
        flying=mlogreader.MLOG_IsFlying(char)
        if flying:
            return
    if Object_Exists(char)==0:
        return
    if foot==1:
        RegTimer('footUpdate',1,0,char)
    if Object_IsAlive(char)==0: ###! in FFvsTTR, character can get resurrected by hero point, restoration and zombie state
        return
    if Object_GetAttr(char,'speed')>9:
        return
    pos=Get_ObjectPos(char)
    dist=(pos[0]-FFX_ObjectGetAttr(char,'lastX'),pos[1]-FFX_ObjectGetAttr(char,'lastY'),0)
    FFX_ObjectSetAttr(char,'lastY',pos[1])
    FFX_ObjectSetAttr(char,'lastX',pos[0])
    if (dist[0]*dist[0]+dist[1]*dist[1]) > getByTemplate(char,FFX_HEAVYFOOTED_CUSTOM,2): #TMX 2007-02-11: * 5: Fixes error in distance, esp. for teleportation
        Trigger_Explosion(char,getByTemplate(char,FFX_HEAVYFOOTED_CUSTOM,1),-1)
        mypos=Get_ObjectPos(char)
        for o in Mission_GetDynamicObjects():
            if o!=char and Object_GetAttr(o,'mass')<210 and \
               (not (hasAttribute(o,'density control') or hasAttribute(o,'acrobatic') or hasAttribute(o,'acrobaticamateur')) ):
                pos=Get_ObjectPos(o)
                dx=pos[0]-mypos[0]
                dy=pos[1]-mypos[1]
                dz=pos[2]-mypos[2]
                r2=dx*dx+dy*dy
                if dz<20 and r2>625 and r2<2500:
                    Trigger_Force(o,0,0,1,Object_GetAttr(o,'mass')*100,TF_ABSOLUTE)

this is actually an attribute called foot..given to juggernaut through ffedit or multiattributing.  You can customize this boost all you want for different characters like bulldozer, rhino, hell even a 'rebound' power for luke cage.  Just gotta name the swap something different instead of pathdestruction...kudos
Title: Re: Customized boost powers
Post by: TrajkLogik on June 14, 2010, 01:45:17 PM
Pretty cool! It's nice to see someone pumping out some new attributes and swaps. Thanks. Actually, I've been trying to figure out a new way of simulating charging attacks by the slower characters, (Juggy, Bulldozer, etc.) rather than using the Speeding Bullet Power. This kind of gives me a different perspective on how I might be able to do it.