• Welcome to Freedom Reborn Archive.
 

New Attribute: Genetic Symbiote

Started by TaskMasterX, July 18, 2007, 08:19:50 PM

Previous topic - Next topic

TaskMasterX

Okay, I did try to make this part of the existing Symbiote Attribute but it wouldn't cooperate, so I made it it's own Attribute. I got the idea from the Blood Brothers, a pair of big brutes that have tangled with the Avengers before. When they are close together, they get stronger and harder to bring down. The closer they are, the stronger they are. So, I came up with Genetic Symbiote. You can customize the character who is your symbiote, the range, and the FX that plays on your character and his symbiote. When the characters are within short range (short range being 1/3 of the range (default is 400)) of each other, the bonus is +3 to Strength, +3 to Agility, +1 to Speed, +2 Endurance, +2 Energy, and 5 Invulnerable points.
At medium range, +2 Strength, +2 Agility, +1 Speed, +1 Endurance, +1 Energy, +2 Invulnerable Points.
At long range, +1 Strength, +1 Agility, +1 Speed, +Endurance, +1 Energy.
The bonuses are not given to both the character and the symbiote, only the character with this attribute gets the bonuses. If both characters have this attribute AND are each other's symbiote, then they both get the bonuses. Or, you can have one character have this attribute and the symbiote not have this attribute and only the character will get the bonues or give the symbiote this attribute but have a different symbiote for it.
Here's the code for ffx.py:
########################################## Genetic Symbiote ############################################
# Increases physical stats and adds invulnerable points when genetic symbiote is close by.
# The closer they are the higher the bonuses.
# -TaskmasterX
# ATTRIB_GENETICSYMBIOTE_01, genetic symbiote
# ATTRIB_GENETICSYMBIOTE_DESC_01, when your genetic symbiote is close by your physical stats (strength, speed, agility, endurance, energy) and invulnerability increase. The closer you are, the higher the bonus!
########################################################################################################

def initgeneticsymbiote(char,update=0):
    if update==0:
        RegTimer('geneticSymbioteCheck',1,0,char)

def geneticSymbioteCheck(event):
    char=event.object
    if Object_Exists(char)==0:
        return
    if Object_IsAlive(char)==0:
        return
    radius=getByTemplate(char,FFX_GENETICSYMBIOTE_CUSTOM,1)
    radius2=radius*radius
    RegTimer('geneticSymbioteCheck',2,0,char)
    for obj in Mission_GetDynamicObjects():
        if ((Object_GetClass(obj)&FFX_CHARACTER!=0)) & (obj!=char) & ((Object_GetClass(obj)&js.OC_TERRAIN)==0) & ((Object_GetClass(obj)&js.OC_VEHICLE)==0) & ((Object_GetClass(obj)&js.OC_BUILDING)==0) & ((Object_GetClass(obj)&js.OC_GENERIC)==0):
            if Object_Exists(obj)==0:
                return
            if Object_IsAlive(obj)==0:
                return
            d=distanceSq(obj,char)
            if d<radius2:
                print 'found symbiote in range...'
                target=getTargetname(obj)
                matchgeneticSymbiote(char,target,obj)
            else:
                print 'genetic symbiote not in range...'
        else:
            print 'cannot find genetic symbiote!'

def matchgeneticSymbiote(char,target,obj):
    geneticSym=getByTemplate(char,FFX_GENETICSYMBIOTE_CUSTOM,2)
    print 'matchgeneticSymbiote...'
    print 'target=%s'%(target)
    print 'geneticSym=%s'%(geneticSym)
    if geneticSym==target:
        playSynergyFX(char,FFX_GENETICSYMBIOTE_CUSTOM)
        playGSFXonTargets(char,obj,FFX_GENETICSYMBIOTE_CUSTOM)
        print 'geneticSymbiote match found!'
        RegTimer('GStrackTarget',0.1,0,char,obj)
        return
    else:
        print 'blood brother match NOT found!'

def playGSFXonTargets(char,obj,array):
    print 'GS FX on Target'
    if FFX_ObjectGetAttr(char,'synfx2',0)==0:
        FFX_ObjectSetAttr(char,'synfx2',1)
        RegTimer('restoreSynFX2',1,0,char)
        fx=getByTemplate(char,array,4)
        if fx!='':
            Object_PlayEffect(obj,fx,'',FX_TRACK_OBJECT_FULL)

def GStrackTarget(event):
    char=event.object
    obj=event.string
    pos1 = Get_ObjectPos(char)
    pos2 = Get_ObjectPos(obj)
    dist = cshelper.distance2D(pos1, pos2)
    radius=getByTemplate(char,FFX_GENETICSYMBIOTE_CUSTOM,1)
    short = radius/3
    medium = short*2
    if dist > radius:
        print 'genetic symbiote NOT in range!'
        cancelGSymbiote(char)
        return
    if dist < radius:
        RegTimer('GStrackTarget',1,0,char,obj)
        if dist < short:
            strbonus=Object_GetAttr(char,'templateStrength')+3
            Object_SetAttr(char,'strength',strbonus)
            Object_SetAttr(char,'baseStrength',strbonus)
            aglbonus=Object_GetAttr(char,'templateAgility')+3
            Object_SetAttr(char,'agility',aglbonus)
            Object_SetAttr(char,'baseAgility',aglbonus)
            spdbonus=Object_GetAttr(char,'templateSpeed')+1
            Object_SetAttr(char,'speed',spdbonus)
            Object_SetAttr(char,'baseSpeed',spdbonus)
            baseeng=FFX_ObjectGetAttr(char,'baseEnergy')
            newEnergy=baseeng+2
            Object_SetAttr(char,'energy',newEnergy)
            baseHealth = GetBaseHealth(char)
            maxHP=Object_GetAttr(char,'maxHealth')
            hp=Object_GetAttr(char,'health')
            FFX_ObjectSetAttr(char,'gsMaxHP',maxHP)
            endBonus=2
            newMaxHP=getGSHealth(char,endBonus)
            Object_SetAttr(char,'maxHealth',newMaxHP)
            hpBonus = newMaxHP - maxHP
            FFX_ObjectSetAttr(char,'gsHPBonus',hpBonus)
            newHP = hp + hpBonus
            Object_SetAttr(char,'health',newHP)
            bip=FFX_ObjectGetAttr(char,'baseInvPoints')
            if bip==0:
                FFX_ObjectSetAttr(char,'ivlastdam',Object_GetAttr(char,'health'))
                if not FFX_ObjectGetAttr(char,'DamageManagement',0):
                    RegDamage(char,'DamageManagement')
                    FFX_ObjectSetAttr(char,'DamageManagement',1)
                FFX_ObjectSetAttr(char,'invPoints',bip+5)
                FFX_ObjectSetAttr(char,'baseInvPoints',0)
            else:
                FFX_ObjectSetAttr(char,'invPoints',bip+5)
#            print 'geneticSymbiote in short range'
#            print 'geneticSymbiote str=%d'%(Object_GetAttr(char,'strength'))
#            print 'geneticSymbiote agl=%d'%(Object_GetAttr(char,'agility'))
#            print 'geneticSymbiote spd=%d'%(Object_GetAttr(char,'speed'))
#            print 'geneticSymbiote eng=%d'%(Object_GetAttr(char,'energy'))
#            print 'geneticSymbiote inv=%d'%(FFX_ObjectGetAttr(char,'invPoints'))
            return
        else:
            if dist < medium:
                strbonus=Object_GetAttr(char,'templateStrength')+2
                Object_SetAttr(char,'strength',strbonus)
                Object_SetAttr(char,'baseStrength',strbonus)
                aglbonus=Object_GetAttr(char,'templateAgility')+2
                Object_SetAttr(char,'agility',aglbonus)
                Object_SetAttr(char,'baseAgility',aglbonus)
                spdbonus=Object_GetAttr(char,'templateSpeed')+1
                Object_SetAttr(char,'speed',spdbonus)
                Object_SetAttr(char,'baseSpeed',spdbonus)
                baseeng=FFX_ObjectGetAttr(char,'baseEnergy')
                newEnergy=baseeng+1
                Object_SetAttr(char,'energy',newEnergy)
                baseHealth = GetBaseHealth(char)
                maxHP=Object_GetAttr(char,'maxHealth')
                hp=Object_GetAttr(char,'health')
                FFX_ObjectSetAttr(char,'gsMaxHP',maxHP)
                endBonus=1
                newMaxHP=getGSHealth(char,endBonus)
                Object_SetAttr(char,'maxHealth',newMaxHP)
                hpBonus = newMaxHP - maxHP
                FFX_ObjectSetAttr(char,'gsHPBonus',hpBonus)
                newHP = hp + hpBonus
                Object_SetAttr(char,'health',newHP)
                bip=FFX_ObjectGetAttr(char,'baseInvPoints')
                if bip==0:
                    FFX_ObjectSetAttr(char,'ivlastdam',Object_GetAttr(char,'health'))
                    if not FFX_ObjectGetAttr(char,'DamageManagement',0):
                        RegDamage(char,'DamageManagement')
                        FFX_ObjectSetAttr(char,'DamageManagement',1)
                    FFX_ObjectSetAttr(char,'invPoints',bip+2)
                    FFX_ObjectSetAttr(char,'baseInvPoints',0)
                else:
                    FFX_ObjectSetAttr(char,'invPoints',bip+2)
#                print 'geneticSymbiote in medium range'
#                print 'geneticSymbiote str=%d'%(Object_GetAttr(char,'strength'))
#                print 'geneticSymbiote agl=%d'%(Object_GetAttr(char,'agility'))
#                print 'geneticSymbiote spd=%d'%(Object_GetAttr(char,'speed'))
#                print 'geneticSymbiote eng=%d'%(Object_GetAttr(char,'energy'))
#                print 'geneticSymbiote inv=%d'%(FFX_ObjectGetAttr(char,'invPoints'))
                return
            else:
                strbonus=Object_GetAttr(char,'templateStrength')+1
                Object_SetAttr(char,'strength',strbonus)
                Object_SetAttr(char,'baseStrength',strbonus)
                aglbonus=Object_GetAttr(char,'templateAgility')+1
                Object_SetAttr(char,'agility',aglbonus)
                Object_SetAttr(char,'baseAgility',aglbonus)
                spdbonus=Object_GetAttr(char,'templateSpeed')+1
                Object_SetAttr(char,'speed',spdbonus)
                Object_SetAttr(char,'baseSpeed',spdbonus)
                newEnergy=baseeng+1
                Object_SetAttr(char,'energy',newEnergy)
                baseHealth = GetBaseHealth(char)
                maxHP=Object_GetAttr(char,'maxHealth')
                hp=Object_GetAttr(char,'health')
                FFX_ObjectSetAttr(char,'gsMaxHP',maxHP)
                endBonus=1
                newMaxHP=getGSHealth(char,endBonus)
                Object_SetAttr(char,'maxHealth',newMaxHP)
                hpBonus = newMaxHP - maxHP
                FFX_ObjectSetAttr(char,'gsHPBonus',hpBonus)
                newHP = hp + hpBonus
                Object_SetAttr(char,'health',newHP)
                baseeng=FFX_ObjectGetAttr(char,'baseEnergy')
                Object_SetAttr(char,'energy',baseeng)
                bip=FFX_ObjectGetAttr(char,'baseInvPoints')
                FFX_ObjectSetAttr(char,'invPoints',bip)
#                print 'geneticSymbiote in long range'
#                print 'geneticSymbiote str=%d'%(Object_GetAttr(char,'strength'))
#                print 'geneticSymbiote agl=%d'%(Object_GetAttr(char,'agility'))
#                print 'geneticSymbiote spd=%d'%(Object_GetAttr(char,'speed'))
#                print 'geneticSymbiote eng=%d'%(Object_GetAttr(char,'energy'))
#                print 'geneticSymbiote inv=%d'%(FFX_ObjectGetAttr(char,'invPoints'))

def getGSHealth(char,endBonus):
    baseEnd = GetCharacterData(char)['endurance']+endBonus
    if Object_GetClass(char) & OC_CONTROLLABLE:
        return int (( baseEnd**2 + baseEnd + 2 ) * 5 )
    else:
        diff6health = (15,30,60,105,165,480,660,870,1110,1380)
        diffdiv = (0, 9, 4, 3, 2, 1.5, 1, 0)
        return int(diff6health[baseEnd]/diffdiv[int(ff.RPG_GAME_DIFFICULTY)] )

def cancelGSymbiote(char):
    str=Object_GetAttr(char,'templateStrength')
    Object_SetAttr(char,'strength',str)
    Object_SetAttr(char,'baseStrength',str)
    agl=Object_GetAttr(char,'templateAgility')
    Object_SetAttr(char,'agility',agl)
    Object_SetAttr(char,'baseAgility',agl)
    spd=Object_GetAttr(char,'templateSpeed')
    Object_SetAttr(char,'speed',spd)
    Object_SetAttr(char,'baseSpeed',spd)
    baseeng=FFX_ObjectGetAttr(char,'baseEnergy')
    Object_SetAttr(char,'energy',baseeng)
    baseHealth = GetBaseHealth(char)
    maxHP=Object_GetAttr(char,'maxHealth')
    hp=Object_GetAttr(char,'health')
    FFX_ObjectSetAttr(char,'gsMaxHP',maxHP)
    endBonus=0
    newMaxHP=getGSHealth(char,endBonus)
    Object_SetAttr(char,'maxHealth',newMaxHP)
    hpBonus = newMaxHP - maxHP
    FFX_ObjectSetAttr(char,'gsHPBonus',hpBonus)
    newHP = hp + hpBonus
    Object_SetAttr(char,'health',newHP)
    bip=FFX_ObjectGetAttr(char,'baseInvPoints')
    FFX_ObjectSetAttr(char,'invPoints',bip)
#    print 'cancelGSymbiote'
#    print 'geneticSymbiote str=%d'%(Object_GetAttr(char,'strength'))
#    print 'geneticSymbiote agl=%d'%(Object_GetAttr(char,'agility'))
#    print 'geneticSymbiote spd=%d'%(Object_GetAttr(char,'speed'))
#    print 'geneticSymbiote eng=%d'%(Object_GetAttr(char,'energy'))
#    print 'geneticSymbiote inv=%d'%(FFX_ObjectGetAttr(char,'invPoints'))


and the code for ffxcustom2.py:
### Genetic Symbiote
FFX_GENETICSYMBIOTE_CUSTOM=[
["default",400,"","effect_ffxabsorbstrength","effect_ffxpurplestrength"],
["types","iRadius","UGenetic Symbiote","OCharacter FX","OObject FX"],
["blood brother",400,"blood brother","effect_ffxabsorbstrength","effect_ffxpurplestrength"],
]



BentonGrey


USAgent

This will work great for Hammer and Anvil!    Great idea Task!

vamp

This seems cool. I was wondering if it would be possible to make it that they die when to far. I think this would be interesting for things the GL's summon