News:

Happy 20th, FFvT3R!

Main Menu

Epic Weapon Attribute

Started by blackjacket, June 11, 2010, 02:35:12 AM

Previous topic - Next topic

blackjacket

Hey..i decided to add an epic weapon attribute when I was making my Hercules.  I used the weapon master script as a basis.  The reason I did this was because I didn't want just anyone having the same powers with the golden mace if they happened to pick it up.  Also i didn't want to have hercules morph into a mesh holding the mace.  SO i did the epic weapon attribute:

def initepicweapon(char,update=0):
   if update==0:
      RegTimer('epicweaponcheck',1,0,char)

def epicweaponcheck(event):
   char=event.object
   template=getByTemplate(char,FFX_EPICWEAPON_CUSTOM,1)
   EpicWield=FFX_ObjectGetAttr(char,template)
   AddedPowers=FFX_ObjectGetAttr(char,'EpicAdded')
   data=getEpicWeaponData(template)
   if EpicWield==1:
      if AddedPowers==0:
         addWeaponPowers(data,char,0)
         FFX_ObjectSetAttr(char,'EpicAdded',1)
   else:
      if AddedPowers==1:
         removeWeaponPowers(data,char)
         FFX_ObjectSetAttr(char,'EpicAdded',0)
   RegTimer('epicweaponcheck',0.5,0,char)

def getEpicWeaponData(template):
    for type in FFX_EpicWeapons:
        if type[0]==template:
            return type
    return FFX_EpicWeapons[0]

def OnThrewWeapon(target,char):
    for type in FFX_Weapons:
        amstat='a%s'%(type[0])
        ammo=FFX_ObjectGetAttr(char,amstat)
        if ammo!=0:
            name=getDummyName()
            pos=Get_ObjectPos(target)
            cshelper.spawn(name,type[0],(pos[0]+10,pos[1]+10,pos[2]))
            Object_SetAttr(name,'maxEnergyPoints',ammo)
            #remove all commands from the weapon
            removeWeaponPowers(type,char)
            handle=int(FFX_ObjectGetAttr(char,'fx%s'%(type[0])))
            Object_StopEffect(char,handle)
            Object_SetAttr(char,'ffxArmed',0)
            AddWeaponCommands(char)
            FFX_ObjectSetAttr(char,amstat,0)
            FFX_ObjectSetAttr(char,type[0],0)
            #remove the sheathe command for weaponbearers
            Mission_RemoveCustomAction('CUSTOM_SHEATHE',char,char)


This also causes the weapon to be removed if hercules uses the throw command for the mace.

There is also a customization in ffxcustom2.py:
FFX_EPICWEAPON_CUSTOM=[
["default","weap_golden_mace"],
["types","wWeapon"],
["hercules_bare","weap_golden_mace"],
["hercules_bare_skirmish","weap_golden_mace"],
]

also had to add script for the powers i made in ffxedit in the ffxextras.py..like the weapon master attribute requires

def OnUseHER_Golden_Mace(target,char):
    ffx.OnUseWeapon(target,char,'HER_Golden_Mace')

def OnUseHER_Destroy_Barrier(target,char):
    ffx.OnUseWeapon(target,char,'HER_Destroy_Barrier')

def OnUseHER_Mace_Of_Power(target,char):
    ffx.OnUseWeapon(target,char,'HER_Mace_Of_Power')

def OnUseHER_Throw_Mace(target,char):
    ffx.OnUseWeapon(target,char,'HER_Throw_Mace')
    ffx.RegTimer2('OnThrewWeapon',2,(target,char))

the only thing that displeases me with this attribute is i have no ai for the cpu to use it when it's hercules..thus it is only a player specific power.