Aller au contenu

Photo

Script stopped working, desperate for clues.


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
manageri

manageri
  • Members
  • 394 messages
I've made a little mod that automatically enables combat modes for characters because there's a bug that disables them for the main PC when you aren't controlling it, and because it's annoying to have to remember to switch rapid shot on for the ranger every time you load the game etc. It used to work totally fine, but now the Manyshot portion of it suddenly stopped working, everything else is working fine. I have no idea what could be wrong but I'll post the relevant bits of code here in case someone sees any potential issues. Also, I had the issue in MotB, which is a mod I haven't tried this in before, so could that be relevant? If anyone has any other ideas that'd be appreciated too.

Here's the code for the feat that toggles the automatic Manyshot:

int bUseMS = GetLocalInt(OBJECT_SELF, "MS");

if (bUseMS == 1)
    {
    bUseMS = 0;
    SpeakString("Manyshot Off", TALKVOLUME_TALK);

    }
    else
    {
    bUseMS = 1;
    SpeakString("Manyshot On", TALKVOLUME_TALK);
    }
SetLocalInt(OBJECT_SELF, "MS", bUseMS);



Here's the relevant parts for what's run at the end of the combat round:

object oTarget = GetLocalObject(OBJECT_SELF, "oTarget");
void ForceManyShot()
{
if    (GetWeaponRanged(oWeapon))
    ActionUseFeat(FEAT_MANYSHOT, oTarget);
}


int bUseMS = GetLocalInt(OBJECT_SELF, "MS");
    if (bUseMS == 1)
    {
    ForceManyShot();
    }   



Edit: After further testing I've found it still works fine in SoZ so my main suspicion now is that MotB breaks it somehow but I've no clue why or what to try next.

Modifié par manageri, 22 décembre 2011 - 05:10 .


#2
MasterChanger

MasterChanger
  • Members
  • 686 messages
This is an interesting issue. Have you found that all combat modes are disabled when you switch to another character? I know there's a setting on the behavior tab relating to using combat modes or not. Perhaps having Tony K's full options installed changes this in some way.

Also, have you found that you can enable any combat mode you like via ActionUseFeat? I recall a conversation someone was having -- TheFred, I think -- about modes where we came to the conclusion that some modes (Stealth, Search) could be enable via SetCombatMode* and some (Power Attack IIRC) could not.

Also also, I see that you retrieve a local object called "oTarget" from the attacker. Is current target really stored this way, or is that an object you have set? If it is stored that way, where along the line is it defined in DetermineCombatRound?

Your work seems to have a lot of interesting potential. :-)

#3
manageri

manageri
  • Members
  • 394 messages
Yes, I've found the game has a bug where all combat modes are disabled at the end of the round for the main PC if you are not possessing it at the time. I don't know whether Tony K's addresses it because I always play with my whole party on puppet mode, it might even not be an issue with the default AI as long as puppet mode isn't on.

I don't use ActionUseFeat except for manyshot since it's not really a "mode", but it's very modish so I made a toggle for it as well. For the real modes I use SetActionMode, and it works totally fine for me on all modes that I've tried (I haven't tried stealth or search because they don't suffer from the bug). I actually had issues not with turning modes on but turning them off. The only way I found to have a script turn modes off is to first remove the mode from the player (by deleting the feat). I have no idea why it works that way but it's an acceptable workaround, after all you don't need the mode feat when you aren't using it except for level up purposes.

I haven't set oTarget myself, I've no idea where it's set but it must be in one of Obsidian's include files that I'm using. I also tried retrieving the target myself with GetAttackTarget but both work the same (or in MotB don't work) so I left it as is.

If you wanna take a look at the whole thing it's posted on the vault here http://nwvault.ign.c...id=83394&id=354

#4
manageri

manageri
  • Members
  • 394 messages
Figured it out, it wasn't working because my script didn't take into account the fact rangers have a different Manyshot feat, argh.