Aller au contenu

Photo

Chargen issues


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

#1
Anomaly-

Anomaly-
  • Members
  • 366 messages
I've been playing around with this for some time. I've finally managed to get race/class bonuses to apply to characters the way I want, however, no matter what I do I can't seem to get the 'x per level' bonuses to work. Here is my code in sys_autoscale_h:

        // -------------------------------------------------------------------------
        // Set stats that are modified per level.
        // instead of looping, we just multiply by level
        //
        // Note:
        //   Rank Modifier is applied to only Health and Mana.
        // -------------------------------------------------------------------------


        float fDamageMod = (GetclassDataFloat(class_DATA_DAMAGE_BONUS    , nclass) + (GetRaceDataFloat(RACE_DATA_DAM_PER_LEVEL, nRace))) * nLevelsToAdd;
        float fHealth    = (GetclassDataFloat(class_DATA_HEALTH_PER_LEVEL, nclass) * fRankModifierHealth) * nLevelsToAdd ;
        float fMana      = GetclassDataFloat(class_DATA_MANA_PER_LEVEL,   nclass) * nLevelsToAdd * fRankModifier;
        float fDefMod    = (GetclassDataFloat(class_DATA_DEFENSE_PER_LEVEL, nclass) + (GetRaceDataFloat(RACE_DATA_DEF_PER_LEVEL, nRace))) * nLevelsToAdd;
        float fArmMod    = (GetclassDataFloat(class_DATA_ARMOR_PER_LEVEL, nclass) + (GetRaceDataFloat(RACE_DATA_ARM_PER_LEVEL, nRace))) * nLevelsToAdd;
        float fAttMod    = (GetclassDataFloat(class_DATA_ATTACK_PER_LEVEL, nclass) + (GetRaceDataFloat(RACE_DATA_ATT_PER_LEVEL, nRace))) * nLevelsToAdd;


        Chargen_ModifyCreaturePropertyBase(oCreature,PROPERTY_ATTRIBUTE_DAMAGE_BONUS, fDamageMod);
        Chargen_ModifyCreaturePropertyBase(oCreature,PROPERTY_DEPLETABLE_HEALTH, fHealth);
        Chargen_ModifyCreaturePropertyBase(oCreature,PROPERTY_DEPLETABLE_MANA_STAMINA, fMana);
        Chargen_ModifyCreaturePropertyBase(oCreature,PROPERTY_ATTRIBUTE_DEFENSE, fDefMod);
        Chargen_ModifyCreaturePropertyBase(oCreature,PROPERTY_ATTRIBUTE_ARMOR, fArmMod);
        Chargen_ModifyCreaturePropertyBase(oCreature,PROPERTY_ATTRIBUTE_ATTACK, fAttMod);



Damage,  health and mana bonuses work, the rest don't. And I don't think the race part of damage bonus works, either. I've spent quite a long while on this and just can't seem to get this to work. Any ideas?

Edit: and yes, I've added the fields to the gda files and defined the constants in 2da_constants.

Modifié par Anomaly-, 05 avril 2010 - 05:44 .


#2
CID-78

CID-78
  • Members
  • 1 124 messages
have you checked so nothing is overwritting your changes. ie something is changing those attributes after you making it look like it doesn't work.

#3
Anomaly-

Anomaly-
  • Members
  • 366 messages

CID-78 wrote...

have you checked so nothing is overwritting your changes. ie something is changing those attributes after you making it look like it doesn't work.


I don't think so. I basically expanded on the game's existing code by adding more properties and an additional table. The code is included in the AS_AddclassLevels function which is called as soon as the game defines that a creature is ready to level up. I don't see the changes on myself, or any of my party members. The party member code looks like this:

{
    SetCanLevelUp(oPartyMember,1);


    int nNewLevel = GetLevel(oPartyMember) +1;

    int nXPCur    = GetExperience(oPartyMember);
    int nXPNext   =  GetM2DAInt(TABLE_EXPERIENCE,"XP", nNewLevel);

    int nclass =  GetCreatureCoreclass(oPartyMember);
    int nRace  =  GetCreatureRacialType(oPartyMember);
    int nTalent = GetM2DAInt(TABLE_RULES_classES,"LevelsPerAbility",nclass);
    int nSkill = GetM2DAInt(TABLE_RULES_classES,"LevelsPerSkill",nclass);

    while (nXPCur >= nXPNext && nXPNext > 0)
    {

        #ifdef DEBUG
        Log_Trace(LOG_CHANNEL_REWARDS,"Levelup_SetReadyToLevelUp",ToString(nXPCur) + " >= " + ToString(nXPNext)+ "... running levelup",oPartyMember);
        #endif

         if (nTalent> 0 && nNewLevel %nTalent ==0)
        {
            Chargen_ModifyCreaturePropertyBase(oPartyMember,PROPERTY_SIMPLE_TALENT_POINTS, 1.0f);
        }

        if (IsHumanoid(oPartyMember))
        {
            if (nSkill>0 && nNewLevel % nSkill == 0)
            {
                 Chargen_ModifyCreaturePropertyBase(oPartyMember,PROPERTY_SIMPLE_SKILL_POINTS, 1.0f);
            }
        }
        else
        {
            // -----------------------------------------------------------------
            // No XP for non humanoids
            // -----------------------------------------------------------------
            SetCreatureProperty(oPartyMember,PROPERTY_SIMPLE_SKILL_POINTS, 0.0f);
        }

        // Add 3 attribute points
        Chargen_ModifyCreaturePropertyBase(oPartyMember,PROPERTY_SIMPLE_ATTRIBUTE_POINTS, 3.0f);
        AS_AddclassLevels(oPartyMember, nclass,1, 0.0f, FALSE, FALSE);


AS_AddclassLevels is one of the last functions called, so I don't see what could be overwriting it. The only other thing I can think of is the part that deals with autoscale strategy packages, but even so, as far as I can tell those only modify a creature's six main attributes (strength, dex, etc), so I don't see how that can be overwriting it, either. Also, I see no other code that adds health/damage per level, so I have no idea why those would be working and not the rest. The scripts I've compiled are sys_chargen, player_core and creature_core. Are there any others I should include? I've also tried including plt_gen000pt_backgrounds just for the hell of it, but still no change.

#4
Anomaly-

Anomaly-
  • Members
  • 366 messages
Ok, after a ton of fiddling around, I've finally got the bonuses working. I still have problems, though. First of all, no matter where I fire off AS_AddclassLevels, the bonuses don't add until after the character exits the level up screen. Secondly, the bonuses add everytime you exit the level up screen, even if you just press next without spending anything. Obviously, this means you can exploit it to continue racking up bonuses by not spending any points.

I suppose I can solve the second problem by doing a check to see that there are no more attributes to spend, but it is inelegant and doesn't solve the first problem. What I'd really like is for the bonuses to be added at the same time the health and base damage bonuses are added in the original game (as soon as you gain a level, and before you click the +). Anyone know how to do this?