Aller au contenu

Photo

Function to return all of a creature's abilities?


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

#1
FergusM

FergusM
  • Members
  • 460 messages
I'm looking for an easy way to reset the cooldowns on all my party's abilities. My thinking was basically get creature, get an array of its abilties, iterate through array, setting cooldown to 0. However, I can't locate something that will give me the creature's current abilities. I happen to know what they all are, so I could just enter the IDs manually, but that seems pretty messy.

Alternatively, if there is a function that just straight up resets all cooldowns, that would work too.

#2
Nattfodd

Nattfodd
  • Members
  • 321 messages
I still not used it but i think this should works: SetCooldown().

#3
FergusM

FergusM
  • Members
  • 460 messages
That will set the cooldown of a particular ability but the challenge is getting the ability ID to give to that function.

#4
Craig Graff

Craig Graff
  • Members
  • 608 messages
GetAbilityList should work for you.

#5
FergusM

FergusM
  • Members
  • 460 messages
I am hopeless. I cannot find GetAbilityList. What script is it from?

#6
Craig Graff

Craig Graff
  • Members
  • 608 messages
Hrm... it might be a function that is coming, but not in currently. I'm not spotting it in my toolset at home.

#7
FergusM

FergusM
  • Members
  • 460 messages
I suppose I'll just manually input the IDs for each ability. It would definitely be a handy function to have, though.

#8
Craig Graff

Craig Graff
  • Members
  • 608 messages
I haven't played with it, but this might (or might not) let you do what you want if you use ABILITY_CONDITION_NONE. From player_core:

    // Disable modal abilities that have their condition changed.
    // #define ABILITY_CONDITION_NONE          0x0
    // #define ABILITY_CONDITION_MELEEWEAPON   0x1
    // #define ABILITY_CONDITION_SHIELD        0x2
    // #define ABILITY_CONDITION_RANGEDWEAPON  0x4
    // #define ABILITY_CONDITION_BEHINDTARGET  0x8
    // #define ABILITY_CONDITION_DUALWEAPONS 0x040
    // #define ABILITY_CONDITION_2HWEAPON 0x080

    // -------------------------------------------------------------------------
    int[] abi = GetConditionedAbilities(OBJECT_SELF, 0xC7);

Modifié par Craig Graff, 23 février 2010 - 02:54 .


#9
FergusM

FergusM
  • Members
  • 460 messages
object oGuy = GetObjectByTag("guy");

int[] abilities = GetConditionedAbilities(oGuy,0x0);

DisplayStatusMessage(IntToString(GetArraySize(abilities)));



Tells me that its a size 0 array. Tried it with 0x4 (he has ranged talents), but same result. Given that it's used in player_core, it's obviously working but I can't see what I'm doing wrong. I'm definitely getting the creature object.

#10
Nattfodd

Nattfodd
  • Members
  • 321 messages
I don't know if is it possible to extract all the abilities of abi_base, but if possible, then you can test if the follower has the abilities you extracted with the function int HasAbility( object oCreature, int nABI_base_Ability ) and set its cooldown with the SetCooldown().

#11
anakin5

anakin5
  • Members
  • 258 messages
Here is a function I use to learn all abilities. You can take inspiration from it :

[color="#99ccff"]int[/color] nSpells = GetM2DARows(TABLE_ABILITIES_SPELLS);
  [color="#99ccff"]int[/color] nRow;
  [color="#99ccff"]int[/color] nID;
  [color="#99ccff"]int[/color] nGuitype;

  [color="#99ccff"]int[/color] i;
  [color="#99ccff"]for[/color] (i = [color="#cc99ff"]0[/color]; i < nSpells; i++)
  {
    nRow = GetM2DARowIdFromRowIndex(TABLE_ABILITIES_SPELLS, i);
    nID = GetM2DAInt(TABLE_ABILITIES_SPELLS, [color="#3366ff"]"ID"[/color], nRow);
    nGuitype = GetM2DAInt(TABLE_ABILITIES_SPELLS, [color="#3366ff"]"guitype"[/color], nRow);

    [color="#99ccff"]switch[/color](nGuitype)
    {
      [color="#99ccff"]case[/color] [color="#cc99ff"]1[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]2[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]3[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]4[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]8[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]9[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]10[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]11[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]12[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]101[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]102[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]103[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]104[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]105[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]106[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]107[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]108[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]109[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]110[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]111[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]112[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]113[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]114[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]115[/color]:
      [color="#99ccff"]case[/color] [color="#cc99ff"]117[/color]:
      {
        AddAbility([color="#99ccff"]OBJECT_SELF[/color], nID);

        [color="#99ccff"]break[/color];
      }
      [color="#99ccff"]default[/color]:
      {
        [color="#99ccff"]if[/color] (nID >= [color="#cc99ff"]300000[/color])
          AddAbility([color="#99ccff"]OBJECT_SELF[/color], nID);

        [color="#99ccff"]break[/color];
      }
    }
  }

Modifié par anakin5, 23 février 2010 - 03:34 .


#12
Magic

Magic
  • Members
  • 187 messages
Before you check for all abilities, maybe you can simply check your level up template? That's what I did for the quickslots, since my followers don't rebuild on hiring. It's probably slower if you have to use 2da access, I guess - might still be easier though. The 2da functions' comments say they should be avoided but on the other hand they're heavily used in combat scripts, so I'm not really sure.

#13
FanfanVilperdue

FanfanVilperdue
  • Members
  • 18 messages
See http://social.biowar...71/index/621100. Special thanks to Craig Graff, Sunjammer and Anakin5 for the help.

Modifié par FanfanVilperdue, 13 avril 2010 - 04:08 .