Aller au contenu

Photo

Adding talents and skills


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

#1
Lathaon

Lathaon
  • Members
  • 163 messages
I have successfully done this on the player using _AddAbility and am pleased with the way that worked out (automatically adding them to the quick bar).

However, when I try to add some to a companion using exactly the same method, nothing happens. The object is definitely valid; I have tried applying effects to him to check this.

I have tried _AddAbility, AddAbility, AddAbilityEx, EffectAddAbility with both Effects_HandleApplyEffectAddAbility and ApplyEffectOnObject, and none of these worked.

I noticed you can add them manually in the creature editor but not when the creature has a package (which he does, but so does the player).

Any ideas? Clearly it's possible, since Wynne gains one somehow...

Edit: I have now also tried RW_GrantHeroBonusAbilityPoint and that didn't have any effect either.

Modifié par Lathaon, 23 août 2010 - 12:07 .


#2
FergusM

FergusM
  • Members
  • 460 messages
Could you give an example of how you are using some of these functions?



When are you trying to add the ability? If you are doing it before as at the same time as the creature being hired into the party, you might be having problems because the creature is wiped and rebuilt following their package at that time.

#3
TimelordDC

TimelordDC
  • Members
  • 923 messages
Wynne's ability gets added using the AddAbility function only.

If you could post the part of the code that does the work, that will help.

#4
Lathaon

Lathaon
  • Members
  • 163 messages
Very well. I'm using them on an area script on the EVENT_TYPE_AREALOAD_SPECIAL event. The same script also hires the follower. I'm planning on using a plot flag for the condition when I get to those...


object oIstovar = GetObjectByTag("vgk_npc_istovar");
            if (!IsFollower(oIstovar)) {

                UT_HireFollower(oIstovar);
                SetLocalInt(oIstovar, CREATURE_REWARD_FLAGS, 0);  //Allows the follower to gain XP
                SetFollowerState(oIstovar, FOLLOWER_STATE_ACTIVE);  //Adds follower to the active party
                Chargen_InitializeCharacter(oIstovar);
                Chargen_SelectCoreclass(oIstovar, class_ROGUE);
                AL_SpendAttributePoints(oIstovar, TABLE_AL_ROGUE_DEFAULT, TRUE);
                AL_SpendSkillPoints(oIstovar, TABLE_AL_STEN);
                AL_DoAutoLevelUp(oIstovar, TRUE, FALSE);

                object oPC = GetHero();
                ApplySpeedIncrease(oIstovar);
                ApplySpeedIncrease(oPC);

                _AddAbility(oPC, ABILITY_TALENT_STEALTH);
                _AddAbility(oPC, ABILITY_TALENT_SUMMON_SPIDER);
                _AddAbility(oPC, ABILITY_TALENT_DUAL_WEAPON_FLURRY);

                //Here's where I've been trying things... eg:
                _AddAbility(oIstovar, ABILITY_TALENT_STEALTH);
            }


Edit: okay, the forum seems to be lowercasing "class"...

Modifié par Lathaon, 23 août 2010 - 12:18 .


#5
Lathaon

Lathaon
  • Members
  • 163 messages
Okay, I managed to solve this myself.

DelayEvent did the trick.

EDIT: (as response to Nattfodd)

The way I did it was to create a script, "vgk_nss_addability" as follows:

#include "utility_h"
#include "sys_areabalance"
void main() {
    event eEvent = GetCurrentEvent();
    if (GetEventType(eEvent) == EVENT_TYPE_CUSTOM_EVENT_01) {
        object oTarget = GetEventCreator(eEvent);
        int nAbility = GetEventInteger(eEvent, 0);
        if (GetEventInteger(eEvent, 1))
            RemoveAbility(oTarget, nAbility);
        else
            _AddAbility(oTarget, nAbility);
    }
}

Then to add an ability, use this:

event eAbility = SetEventCreator(Event(EVENT_TYPE_CUSTOM_EVENT_01), oCreature);
DelayEvent(0.1f, oCreature, SetEventInteger(eAbility, 0, ABILITY_WHATEVER), "vgk_nss_addability");

Modifié par Lathaon, 28 septembre 2010 - 07:43 .


#6
FergusM

FergusM
  • Members
  • 460 messages
Yep, the problem was definitely the fact that creatures get wiped when you hire them.

#7
Nattfodd

Nattfodd
  • Members
  • 321 messages
Please, can you post the working code?



thanks.