Dragon Disciples almost done...question

Hi everyone,

I posted on Discord but it is always a hit and miss for me when I ask questions there. Also, people comment on other things and my question gets lost…

So here I hope I can get an answer to a couple of questions.

First, I have all my dragon breaths for the basic dragon disciples working except the acid breath. Why I can’t figure out. It crashes the game. The others (Lightning, Cold, Gas, Fire…all work).

Here is the script for the acid…now why won’t it work like the others? The cls_feat points to the right line on the feat and also on the spell 2das.

See script below:

//:: Breath Weapon for Dragon Disciple Class
//:: x2_s2_discbreath
//:: Copyright (c) 2003Bioware Corp.
//:://////////////////////////////////////////////
/*

  Damage Type is Fire
  Save is Reflex
  Shape is cone, 30' == 10m

  Level      Damage      Save
  ---------------------------
  3          2d10         19
  7          4d10         19
  10          6d10        19

  after 10:
   damage: 6d10  + 1d10 per 3 levels after 10
   savedc: increasing by 1 every 4 levels after 10



*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: June, 17, 2003
//:://////////////////////////////////////////////

#include "NW_I0_SPELLS"


void main()
{
    int nType = GetSpellId();
    int nDamageDice;
    int nSaveDC = 19;

    int nLevel = GetLevelByClass(37,OBJECT_SELF);// 37 = acid breath for dragon disciple

    if (nLevel <7)
    {
        nDamageDice = 2;
    }
    else if (nLevel <10)
    {
        nDamageDice = 4;
    }
    else if (nLevel ==10)
    {
        nDamageDice = 6;
    }
    else
    {
      nDamageDice = 6+((nLevel -10)/3);
      nSaveDC = nSaveDC + ((nLevel -10)/4);
    }

    int nDamage = d10(nDamageDice);

    //Declare major variables
    float fDelay;
    object oTarget;
    effect eVis, eBreath;

    int nPersonalDamage;

    eVis = EffectVisualEffect(11271);
    ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eVis,GetSpellTargetLocation());

    //Get first target in spell area
    location lFinalTarget = GetSpellTargetLocation();
    if ( lFinalTarget == GetLocation(OBJECT_SELF) )
    {
        // Since the target and origin are the same, we have to determine the
        // direction of the spell from the facing of OBJECT_SELF (which is more
        // intuitive than defaulting to East everytime).

        // In order to use the direction that OBJECT_SELF is facing, we have to
        // instead we pick a point slightly in front of OBJECT_SELF as the target.
        vector lTargetPosition = GetPositionFromLocation(lFinalTarget);
        vector vFinalPosition;
        vFinalPosition.x = lTargetPosition.x +  cos(GetFacing(OBJECT_SELF));
        vFinalPosition.y = lTargetPosition.y +  sin(GetFacing(OBJECT_SELF));
        lFinalTarget = Location(GetAreaFromLocation(lFinalTarget),vFinalPosition,GetFacingFromLocation(lFinalTarget));
    }
    oTarget = GetFirstObjectInShape(SHAPE_SPELLCONE, 10.0, lFinalTarget, TRUE,  OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR  | OBJECT_TYPE_PLACEABLE);

    while(GetIsObjectValid(oTarget))
    {
        nPersonalDamage = nDamage;
        if(oTarget != OBJECT_SELF && !GetIsReactionTypeFriendly(oTarget))
        {
            //Fire cast spell at event for the specified target
            SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId()));
            //Adjust the damage based on the Reflex Save, Evasion and Improved Evasion.
            //Determine effect delay
            fDelay = GetDistanceBetween(OBJECT_SELF, oTarget)/20;
            if(MySavingThrow(SAVING_THROW_REFLEX, oTarget, nSaveDC, SAVING_THROW_TYPE_ACID))
            {
                nPersonalDamage  = nPersonalDamage/2;
                if(GetHasFeat(FEAT_EVASION, oTarget) || GetHasFeat(FEAT_IMPROVED_EVASION, oTarget))
                {
                    nPersonalDamage = 0;
                }
            }
            else if(GetHasFeat(FEAT_IMPROVED_EVASION, oTarget))
            {
                nPersonalDamage = nPersonalDamage/2;
            }
            if (nPersonalDamage > 0)
            {
                //Set Damage and VFX
                eBreath = EffectDamage(nPersonalDamage, DAMAGE_TYPE_ACID, DAMAGE_POWER_ENERGY);
                eVis = EffectVisualEffect(VFX_IMP_ACID_L);
                //Apply the VFX impact and effects
                DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget));
                DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eBreath, oTarget));
             }
        }
        //Get next target in spell area
        oTarget = GetNextObjectInShape(SHAPE_SPELLCONE, 10.0, lFinalTarget, TRUE,  OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR  | OBJECT_TYPE_PLACEABLE);
    }
}

Also, I have a weird thing going on too. The Dragon Disciples can’t level past level 8. Although on my class 2da it says it can go to level 40. It gives me this weird message in the window in game: “character has applied invalid number of skill points”. But I do assign all the skill points.

Sometimes I can trick it by taking another level or two in Sorcerer (usually when I get to level 10 Sor) then it allows me to take levels above 8 in that other DD.

I created separate classes for each dragon disciple…just so you know.

I have: Black, Blue, Green, White, Brass, Bronze, Copper, Gold, Silver

Is the acid breath suppose to be something else other than a Cone? Maybe the script expects it to be something else like spittle???

How are the other scripts written? Are they the same? Would be interesting to check and compare with the others that work.

Here’s what the Lexicon says about EffectDamage. Could this have to do with anything?

nDamagePower
The DAMAGE_POWER_* to apply for physical damage types to go through EffectDamageReduction effects. NOTE: This is bugged in versions before NWN:EE version 1.87.8193.35 and simply doesn’t do anything see Known Bugs. (Default: DAMAGE_POWER_NORMAL)

but my guess is you have the 87.8193 etc. version.

EDIT: I’ve read through the script about 5-10 times now, and I can see no problems/errors with it. So my hunch/guess is that it’s something to do with what you’ve put into the functions in the script, that somehow causes an error, maybe because different spells work in different ways in the game. Who knows. Again, if I could compare this script to the script (or scripts) that works, it would be easier to pinpoint down where the problems could lie.

Other than this line, the script looks pretty much like a copy of the original. In the original it reads 494. It doesn’t look suspicious, but a line by line compare with the original won’t hurt.

Having different effects of dragon breath requires the definition of custom visual effects; such as 11271. So if one of the custom effects crashes the engine, the usual suspects are the 2da-entries and the model file.

Also, I have a weird thing going on too. The Dragon Disciples can’t level past level 8. It gives me this weird message in the window in game: “character has applied invalid number of skill points”

Now, that is something from outer space …

Where did you get the stuff???

Level 8 is where you increase int? Save that number of skillpoints at level up and it’ll be ok, fix is next patch I think. (I answered on discord.)

There’s an engine function for getreflexadjusteddamage or something like that, takes into account evasion/etc. I don’t like the damage calculation but it shouldn’t be terrible.

Not in love with the dc calculation, but shouldn’t be terrible either. I.e. should never produce negative numbers.

I’m thinking the positioning might have the same problem as the stuff done in x0_i0_position: east or north will be ok but pointing south or west won’t be…if you want a position in front there has to be a math library here that does it correctly. Rotation of axes in two dimensions - Wikipedia equations 5 and 6 under derivation…but is it needed? There are two cone getobjectinshape functions, the one to use is the one used in cone of cold. Think other abilities were updated when the bug was found, but not sure. Better to wait for comment by others for what works, there is an easier solution IIRC.

ETA: the visual effect should just be the impact vfx. Spell vfx would be the impact/conjure animation set in spells.2da

1 Like

Yes, I used the exact same script. I just changed the damage types and vfx to reflect the appropriate cloud…i.e. Cone of Cold VFX for the white dragon disciple which does cold damage.

Not sure why Acid is the only one not working. It crashes my game as soon as I use the breath weapon for Acid.

Thanks Lokey…

So you are saying that this is a known bug? That the Dragon Disciple has this bug that is being fixed in the next patch? If so when is the next patch coming out?

Also, I am no scripter. So, I quoted what you said I’m not sure about. Could you rewrite the script above so it can cmake the acid breath work for me…please.

I created my own dragon disciples based on the Red Dragon disciple. Made one of each colour I mentioned above. Almost there. I guess as Lokey said below…it will be fixed in the next patch.

I do have a question for you Mmat…how would you fix it in the script above where I can reference more than one class for the same breath weapon? For example my Black Dragon Disciple and Copper Dragon Disciple uses the Acid breath…same goes for the other coloured DD’s who share similar breath weapons. The part I’m referring to is below:

Note that is one class (line number on my class.2da) …how in the script would I add say three classes that use the same breath weapon? I tried GetLevelByClass(37,38,39 OBJECT_SELF);

But it did not compile

Thanks andgalf for you input///that is the Red Dragon Disciple vanilla script. I just used it over and over with the damage changes and VFX…so yeah should be right…dunno why it isn’t working. Lokey says it might be a bug that is going to be addressed in the next patch.

The skillpoints makes character fail ELC is the bug.

To script for checking different classes, do something like…
int nLevel = GetLevelByClass(class_row, object_using_ability);
int nTest = GetLevelByClass(other_class_row, object);
if(nlevel < nTest) nClass = nLevel;
nTest = GetLevelByClass(yet_another_class_row, object);
if(nLevel < nTest) nLevel = nTest; etc…

Spell cone: still think wait for advice. Worst case I can look up our breath weaps tonight, but it’s probably a bunch of fancy math/scripting shortcuts that’d take a lot of translation :frowning:

Thanks for all that stuff you posted…but…lol…I am no scripter. I mean I can insert stuff into a script sort of and mimic a script (like I took from the Red Dragon Disciple breath weapon) and change a few spots…but to put the stuff you mentioned above…I dunno :frowning:

Could you put that in the script (fix it) and upload it here for me please?

There are two things handled by the script:

  1. The dragon breath vfx
  2. The damage dealing according to the class.

If you just copied the 2da lines from the rdd-vfx (494) in visualeffects.2da, you should be safe here (save line 11271 doesn’t exist). All dd’s will have a red fire breath (vff_dragbreath). Tscheck it out: comment the lines

// eVis = EffectVisualEffect(11271);
// ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eVis,GetSpellTargetLocation());

No effect will be shown, just damage dealt. Still crashing?

If it’s still crashing, the next will be to test, if the level determination works as expected. Change as shown here:

// int nLevel = GetLevelByClass(37,OBJECT_SELF);// 37 = acid breath for dragon disciple
int nLevel = 8;

Still crashing? Uh … now compare the rest line by line with a working script.

However the proceeding should give you a good pointer, where to continue with the research.

1 Like

If that doesn’t exist, that could very well be the problem.

@Imtherealthing - You really should follow @Mmat 's suggestion here to get to why the crashing occurs. It should pinpoint the problem with the script.

This number for the vfx is on my 2da. I downloaded it a while back. I did try another vfx it still crashed. I will yet again try another see if it still happens.

Below is my visual effects 2da going along the 2da line.

The others work.




What is “vff_dragbreat_ac”? Just an identical copy of the original? Ok, if you tried another effect which is working in other scripts, onward with the next check.

I will do that, but I doubt it will work because I use the exact same script for all the others that work just fine. I just changed the dragon breath vfx and damages for each one. That vff_drag_ac I don’t understand what the “vff” means but the rest I think means dragon breath acid damage.

Just trying to help now…Are the vff_dragbreat_co, vff_dragbreat_el etc. files that you have in your module that are part of what you downloaded? If that’s the case, maybe check if vff_dragbreat_ac actullay exists or if it’s missing. Just a thought.