Issue with a "simple" script!

Howdy folks,
I’ve altered the bioware script 220 Bolt_Knockdown (NW_S1_BltKnckD) to suit my own quirks, and while the spell compiles in the toolset & works properly in-game, the PC’s feedback line obstinately refuses to appear.
I’ve tried FloatingTextStringOnCreature, FloatingTextStrRefOnCreature (with the appropriate .tlk line) and SendMessageToPC, all to no avail.
I’ve customized all sorts of spells, adding feedback info for PCs, but this is the first time it hasn’t worked…
I’m clearly doing something wrong, so any advice would be greatly appreciated.
For what it’s worth, I enclose the code below.

//:: Water Guardian Bolt: Knockdown
//:: watergdn_kdwn.nss
    The Water Guardian must make a ranged touch attack to hit its victim.
    If sucessful, the victim is knocked down for 2 rounds and takes 2d3
    of physical damage.

#include "NW_I0_SPELLS"
void main()
    //Declare major variables
    object oTarget = GetSpellTargetObject();
    effect eVis = EffectVisualEffect(VFX_IMP_SONIC);
    effect eBolt = EffectKnockdown();
    effect eDam = EffectDamage(d3(2), DAMAGE_TYPE_SLASHING);
    //Fire cast spell at event for the specified target
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, 1995));
    //Make a ranged touch attack
    if (TouchAttackRanged(oTarget))
       //Apply the VFX impact and effects
       ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBolt, oTarget, RoundsToSeconds(2));
       FloatingTextStringOnCreature("The blast of water knocks you off your feet ! !", oTarget);
       ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
       ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);


AssignCommand(oTarget, SpeakString("The blast of water knocks you off your feet ! !"));

Instead of

FloatingTextStringOnCreature("The blast of water knocks you off your feet ! !", oTarget);


I don’t see any error there. Is the bolt doing the extra slashing damage? Because if not then the issue is elsewhere - your script gets overriden from hak, patch-hak or /development folder.

Or actually judging from your script name - if the extra damage is not applied then either:

  • monster is using vanilla version of the knockdown bolt and not yours
  • yours knockdown bolt has vanilla script name in spells.2da

Or you simply forgot to create custom spell in spells.2da with this script name and give it to the npc you are testing?

@Shadooow The op said that everything works except that the floating text doesn’t appear.

@pturner20 FWIW SendMessageToPC() sends a message to the PC’s chatbar.


I am folowing a rule of “Everybody lies”…

Well what OP claims is not possible therefore I asked questions I asked.

1 Like

What does the userdefined Event 1995?

Thanks for your interest & time, folks.

No way I’d have thought of this. The script compiled fine, but alas still no feedback on testing.

The NPC does have the correct Monster Ability in the toolset (named Water Knockdown Bolt), and the correct script name (watergdn_kdwn) is present in spells.2da (in the line I copied from the extant Bioware spell.)
So if the script is being overriden, then the spell’s Alt Message to the chat log should be “Water Guardian uses bolt attack”, but it actually uses “Water Guardian spits out a globule of water with great force!” from my custom .tlk!
However, you must be right, because testing reveals that the minimum damage caused is 1hp, which should not be possible when eDam = d3(2)!!! Moreover, I am certain that the knockdown duration lasts for 3 rounds and not the 2 rounds specified in the script!!!
How then, can these two contrary states be possible? I just don’t get it!!

Quite right, except no message appeared!

It’s not a UserDef pointer, just the number from spells.2da to avoid using constants.

I feel a bit guilty about costing you time and effort over this anomaly, particularly since it’s over a small cosmetic issue, so it’s probably best to let it lie unsolved. But as always, I’m thankful for your help.

This one works like fine for me, it’s just circumventing the spell overhead. The strategy is to simplify the script, by retaining the bug. Does it work on your environment? It’s triggered with the “onuse” of any placeable.

void main()
object oPC = GetLastUsedBy();
// AssignCommand (oPC, ActionPlayAnimation (ANIMATION_LOOPING_DEAD_BACK, 1.0, 5.0));
effect eVis = EffectVisualEffect(VFX_IMP_SONIC);
effect eBolt = EffectKnockdown();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBolt, oPC, 6.0);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
DelayCommand (2.0, FloatingTextStringOnCreature(“Autsch!”, oPC)); // DelayCommand actually not needed.

Check development folder, maybe you were testing the spell with that functionality and forgot to remove it?

Check haks. Maybe you added the script watergdn_kdwn into hak? Never put scripts into hak.

Many, many thanks boys for all the help - I’ve lost count of the times that you’ve helped me out one way or the other Especially you, Shadooow!) One of the main reasons I keep plugging away after all these years is knowing that folks like you are there with knowledge and advice.

Anyway, I’ve managed to get it working perfectly now. I think the problem was that I just cut/pasted line 220 to the bottom of my spells.2da, then changed the number/label/script & made my own tlk entries for name/desc/altmessage, but did NOT change the targettype entry.
When I changed 0x2E to 0x3A the script worked perfectly, which leads me to believe that something in the inner workings of the game was causing the default script to use default damage and duration.
So once again, thanks for all your help