Player Resource Consortium

Neverwinter Nights => General Discussion => Topic started by: Complex on March 10, 2011, 02:30:35 PM

Title: OnHit: Arcane archer and Spellsword
Post by: Complex on March 10, 2011, 02:30:35 PM
Hi, i was checking the different switches u guys have to empower or change stuff.
im really keen on the arcane archer switch which allows arcane archers to cast spells at arrows rather than shooting the lame imbue arrow explotion.

Once added the switch into our module (also tried out in a test one), i found out that the system is not working. i also know that spellswords are, or at least used to, not work/ing. So i started reaserching a bit. unfurtunately i was not able to find the solution on forum so i decided to post.

i checked a couple of scripts and found out the folowing in the prc_onhitcast:

Quote
   //spellsword & arcane archer
    //will also fire for other OnHit:UniquePower items that have a SpellSequencer property (such as Duskblade)
    if(GetLocalInt(oItem, "X2_L_NUMCHANNELTRIGGERS"))
    {
        if (DEBUG) DoDebug("prc_onhitcast: Triggering Sequencer Discharge");
        ExecuteScript("x2_s3_sequencer", oSpellOrigin);
    }


i was not able to retrive the exact script where variable NUMCHANNELTRIGGERS is set.

could this be the error to my problem? if this is it, or not, please help since id like to fix this stuff.


BTW: switch works fine, im not getting any uses per day for imbue arrow and im able to cast stuff at arrows getting the "sequencer succes" or smth like that. also some * imbue arrow success *. arrows also get the OnHit unique power. the only issue is that either the arrows are not storing the spell or are not triggering at hit.

help? =)
Title: OnHit: Arcane archer and Spellsword
Post by: Complex on March 11, 2011, 08:14:56 AM
Ok, so ive been working a bit more on this, i found out by debugging that prc_onhitcast triggers successfuly.

tracked down to the spellhook script where nContinue variable returns as 0 when it reaches the if GetisItem(OBJECT_SELF) conditional (this line is not exactly like this, its the line where the script asks if a targeted item is valid in order to trigger the onhit cast). This is right after the DuskBlade conditional.

so... maybe this will help you help me? :P

thanks, id apreciate some sort of answer on this topic. thx again
Title: OnHit: Arcane archer and Spellsword
Post by: xwarren on March 11, 2011, 11:55:40 AM
You are using PRC 3.4, right?

I could swear I tested if spellswords channeling is working when someone reported a bug with sequencer property.

I'll have to check that again, i guess.
Title: OnHit: Arcane archer and Spellsword
Post by: Complex on March 11, 2011, 12:16:05 PM
yeah, we are using 3.4 Final. the latest version available and yet its not working. I tested out spellswords yesterday and the onhit event does not trigger the spell (prolly due to same issue as arcane archers since they share most of the code as far as i read)
Title: OnHit: Arcane archer and Spellsword
Post by: Complex on March 11, 2011, 01:35:35 PM
ok, some moar info: this is some code i extracted from the x2_s3_sequencer script

Quote
if (nSpellId>0)
                {
                    bSuccess = TRUE;
                    nSpellId --; // I added +1 to the spellID when the sequencer was created, so I have to remove it here
                    //modified to use the PRCs casterlevel override to cheatcast at the right level
                    ActionDoCommand(SetLocalInt(OBJECT_SELF, "SpellIsSLA", TRUE));
                    //if(i == 1)
                    //    ActionCastSpell(nSpellId, nLevel,0, nDC, nMeta);
                    //else
                        ActionDoCommand(CastSpellAtObject(nSpellId, PRCGetSpellTargetObject(), nMeta, nLevel, 0, nDC));
                    ActionDoCommand(DeleteLocalInt(OBJECT_SELF, "SpellIsSLA"));

                    if (DEBUG) DoDebug("Channel Spell Cast");
                }



Debug states that script is able to reach this point since i get the channel spell cast msg.

i also get the nLevel and nDC correctly. nMeta is 0 since i did not use any metamagic.

sooooo, im wondering if this is working or even correct:
Quote
ActionDoCommand(CastSpellAtObject(nSpellId, PRCGetSpellTargetObject(), nMeta, nLevel, 0, nDC));
           


i know for sure that nSpellID is grater than 0, otherwhise it would not trigger the Channel Spell Cast Debuging msg
Title: OnHit: Arcane archer and Spellsword
Post by: Complex on March 11, 2011, 01:58:44 PM
sorry to bother xD but i post while i find new shit out to make it easyer for u guys.

followed the white bunny into the CastSpellAtObject function, which should call ExecuteSpellScript

this function has the following line in it:

    if(DEBUG) DoDebug("ExecuteSpellScript: executing script "+sScript);

im not getting this msg on debug screen nor logs, si my guess is that CastSpellAtObject is busted.

Quote
void CastSpellAtObject(int nSpellID, object oTarget = OBJECT_INVALID, int nMetaMagic = METAMAGIC_ANY, int nCasterLevel = 0, int nCasterClass = 0, int nSaveDC = 0, object oItem = OBJECT_INVALID, object oCaster = OBJECT_SELF)
{
    // get the name of the impact spell script (for ExecuteScript)
    // nSpellID points to a row in spells.2da
    string sScript = Get2DACache("spells", "ImpactScript", nSpellID);

    if(sScript == "" || sScript == "****")
        return;

    // create an invalid location
    location lInvalid;

    // execute the spell script
    ExecuteSpellScript(sScript, lInvalid, oTarget, nSpellID, nMetaMagic, nCasterLevel, nCasterClass, nSaveDC, oItem, oCaster);
}


only way to break the script is by getting a "" or a "****" on sScript, there for, Get2DACache("spells", "ImpactScript", nSpellID); could be calling some "" or "****"
Title: OnHit: Arcane archer and Spellsword
Post by: Complex on March 11, 2011, 03:25:53 PM
stuck @ inc_2dachache. cant get the DEBUG_GET2DACACHE variable set to TRUE since its hardcoded into the hak and i should recompile everything to check this out.

prolly for future fixes ud like to change the following line

const int DEBUG_GET2DACACHE = FALSE;

into

const int DEBUG_GET2DACACHE = GetPRCSwitch(PRC_DEBUG_GET2DACACHE );


anyways, im not able to continue past this point, i think the issue is somewhere between CastSpellAtObject from the x2_s3_sequencer script and ExecuteSpellScript from the prc_inc_onhit script.

hope this helps you out xwarren.

thanks for ur help anyways!
Title: OnHit: Arcane archer and Spellsword
Post by: Complex on March 15, 2011, 02:10:51 PM
does anybody think there will be any fix on this?
Title: OnHit: Arcane archer and Spellsword
Post by: xwarren on March 15, 2011, 05:52:02 PM
Quote from: Complex

does anybody think there will be any fix on this?


Of course, but It's a bit more complicated than I first though. Attached script is only temporary fix - will allow channeling for arcane archer and spellsword, but multiple channeling won't work :(.
Title: OnHit: Arcane archer and Spellsword
Post by: Complex on March 15, 2011, 11:01:25 PM
ur the best xwarren! ill take a look at it.

multiple channeling is only a spellsword feature right?

thx again, ill test this out asap !
Title: OnHit: Arcane archer and Spellsword
Post by: Complex on March 18, 2011, 11:01:48 AM
ok, tested this out, i added the script to a hak on top of every other hak i have in a test module.
Did not work

i guess i have to re-compile everything right.
guess ill wait for new patch on prc :( if any will exist.

thx again