• Welcome to Freedom Reborn Archive.
 

FFX3.2 Physical Guardian not right

Started by queo_Lita, February 28, 2008, 12:01:13 PM

Previous topic - Next topic

queo_Lita

OK. So I gave a character the physical guardian attribute and the attribute is messed up. I don't know if this has been an issue before, but here it is:
In the manual it says the dummy power is "ffx_do_physicalshield" and the target power is "ffx_physicalshield".
When they were writing the script they put "ffx_tk_lift" as the dummy power and I have no idea what target power.
So anyway, I remember fixing this issue when I first installed FFX 3.2, it was easy just changed a power name somewhere. It was the wrong one and the dummy power was wrong, but now I can't find it. I found lines in FFX.py that were pointing to an array, but have no idea why it's not working when I change the number ...
Well, what I'm asking is: How do I fix this so it's the way it's supposed to be?
Also - why aren't regular remote defences working in FFvsTTR? It either doesn't happen or crashes. Fun!
Anyway, busy though, got to go :)

HumanTon

Note you can also remotely shield someone by using a beam with an FFX power swap (e.g. a Rally the Troops beam, then power swap Shield in for Rally.)

queo_Lita

Oh, cool, I didn't know that. I'll look into it.
EDIT:
FIXED IT!
:D
OK, it so weird but it's the same bug that I fixed from the previous version of FFX. And oddly enough, it was different. So let me get in to it. In FFX.py
In the previous version the shields were an array that the certain executed code would choose the one it needs. Back then 'ffx_physicalshield' entry was wrong. I entered the correct one as I could find the error fast since next to 'guardianp' there was a different shield name.
This time that was not there and the mistake is actually within the code itself. GuardianM and GuardianP.
They both have certain definitions in the return a power one and a shield one. Both have dummy power - tk_lift, and while the mental shield had the correct power, the physical one still had to choose a template from an array.
So just fixedd the dummy power and made Physical Shield point at the right one.
I feel so acomplished  :wub:

stumpy

Yeah, it's a better solution in many ways. And, using a penetrating beam with invisible beam FX, you can make it look like a direct power. I made a character called Body Guard and gave her a couple powers swapped to different shields. It worked pretty well and gets around the bugs with the in-game remote shield powers. In a future

queo_Lita

I was looking at the shields array. Is it still being used? Anyway. I guess someone overlooked Physical Shield and in the previous one pasted wrong power.
BTW the shields really are a mess, I mean the array thing seems to shorten some time as it had the dummy powers within it before, but now it has ... I don't know.
EDIT: The shield array I was looking at is actually a character array of some sort that defines their shields of some sort. I think this is another clipboard error, as the other ones seem so.
BTW who do I need to contact to tell them about the error and how to fix it so that this would be fixed for the next issue, if they don't decide to change to code again that is. Hopefully with better clipboard control.

stumpy

Quote from: queo_Lita on February 28, 2008, 06:06:53 PMEDIT: The shield array I was looking at is actually a character array of some sort that defines their shields of some sort. I think this is another clipboard error, as the other ones seem so.

I don't exactly know what you mean by the error you are describing.

As it happens, the shield swaps did have some know limitations and are already scheduled for some upgrading as I took  a look at this a little while ago and made some changes to the code. There is a little discussion of it in this thread.

I (and others) often post the code changes I have made so that people can make their own updates before the dev team gets together for the next release of FFX, but there were quite a few changes there, and to a couple of different files, so I didn't post them. If you want a copy of my ffx.py and ffxcustom2.py files, I can make them available.

queo_Lita

Oh, uhmm ... didn't you see my previous edit? I fixed the problem with those shields. I mean the problem with the way FFX.py is now. I'm pretty sure there are going to be changes with the shields.
Thing is in the previous version there was an array of which codes chose their shield power so you only needed to update the array and it would work fine. In the current one there's again a shield array, but it's with character names and respective shields, which I think defines their shield for ... I really have no idea, but I think someone may have pasted the wrong array.
And I think it's not even needed because the code is written to specify dummy power and a target one defined within it. And there were clipboard and overlook errors.
But I though I should share with people how to fix those two (MGuardian and PGuardian) so that they would work as supposed to for them.

Epimethee

Please do share your fix, Queo Lita. :)

FWIW, the Physical Shield and Mental Shield attribute have been obsolete since FFX 2.0, when they were replaced by the power-swap versions; the attributes were kept for backward compatibility with existing user-created characters.

As for the built-in remote defense, it's really too bad; it was *partly* fixed in the never-released patch: it either works or not, but at least doesn't crash the app). Mind you, given how unreliable it is, the swap is probably still a better solution anyway.

queo_Lita

It's in the file FFX.py
After line:
### GUARDIANS ###
*ignore array*
Quote from: correct code

def initguardianm(char,update=0):
    if isMP():
        return
    attr='%s_mshield'%(char)
    Global_RegisterAttr(attr,0)
    for obj in Mission_GetDynamicObjects():
        if ((Object_GetClass(obj) & FFX_CHARACTER)!=0) & (obj!=char):
            if (Object_GetAttr(obj,attr)==0):
                Mission_CustomAction('CUSTOM_SHIELDM',char,obj,'OnMShield',30,0)
                Object_SetAttr(obj,attr,1)
    if update==0:
        Mission_CustomAction('CUSTOM_SHIELDM_TEAM',char,char,'OnMShieldAll',5,0)

def OnMShield(target,char):
    if chargeEP(char,FFX_EP_MINDSHIELD)==0:
        return
    Trigger_Power(char,target,'ffx_do_mindshield','')
    Trigger_Power(target,target,'ffx_mindshield','')

def OnMShieldAll(dummy,char):
    if chargeEP(char,FFX_EP_MINDSHIELD)==0:
        return
    Trigger_Power(char,char,'ffx_do_mindshield','')
    for obj in Mission_GetDynamicObjects():
        if ((Object_GetClass(obj) & (OC_CONTROLLABLE|OC_POLICE|OC_CIVILIAN))!=0) & (obj!=char):
            if distanceSq(obj,char)<250*250:
                Trigger_Power(obj,obj,'ffx_mindshield','')

def initguardianp(char,update=0):
    if isMP():
        return
    attr='%s_pshield'%(char)
    Global_RegisterAttr(attr,0)
    for obj in Mission_GetDynamicObjects():
        if ((Object_GetClass(obj) & FFX_CHARACTER)!=0) & (obj!=char):
            if (Object_GetAttr(obj,attr)==0):
                Mission_CustomAction('CUSTOM_SHIELDP',char,obj,'OnPShield',FFX_SHIELDRANGE,0)
                Object_SetAttr(obj,attr,1)
    if update==0:
        Mission_CustomAction('CUSTOM_SHIELDP_TEAM',char,char,'OnPShieldAll',5,0)

def OnPShield(target,char):
    if chargeEP(char,FFX_EP_PHYSICALSHIELD)==0:
        return
    Trigger_Power(char,target,'ffx_do_physicalshield','')
    Trigger_Power(target,target,'ffx_physicalshield','')

def OnPShieldAll(dummy,char):
    if chargeEP(char,FFX_EP_PHYSICALSHIELD)==0:
        return
    Trigger_Power(char,char,'ffx_do_physicalshield','')
    for obj in Mission_GetDynamicObjects():
        if ((Object_GetClass(obj) & (OC_CONTROLLABLE|OC_POLICE|OC_CIVILIAN))!=0) & (obj!=char):
            if distanceSq(obj,char)<250*250:
                Trigger_Power(obj,obj,'ffx_physicalshield','')
It fixes the shields so now they point to the correct powers.
At this point you can change 'ffx_physicalshield' and 'ffx_mindshield' in FFEdit and make them do whatever you want.
This code only fixes the code so that the shields would work just as pointed out in the manual where 'ffx_do_mindshield' is the dummy power and the executed power on the target is 'ffx_mindshield'.
Hope that helps. Have fun :P