Aller au contenu

Photo

trouble with an unmodified #include?


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

#1
Jeddia

Jeddia
  • Members
  • 17 messages
I went to the Find Traps script and removed the remark from the DisableFlag line so that it would disable traps as well as find them...hopefully I can remember how to post a script...lessee...

[nwscript]//::///////////////////////////////////////////////
//:: Find Traps
//:: NW_S0_FindTrap
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Finds and removes all traps within 30m.
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 29, 2001
//:://////////////////////////////////////////////
// JLR - OEI 08/24/05 -- Metamagic changes
#include "nwn2_inc_spells"

#include "x2_inc_spellhook"
void main()
{
/*
  Spellcast Hook Code
  Added 2003-06-23 by GeorgZ
  If you want to make changes to all spells,
  check x2_inc_spellhook.nss to find out more
 
*/
    if (!X2PreSpellCastCode())
    {
 // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
        return;
    }
// End of Spell Cast Hook

    //effect eVis = EffectVisualEffect(VFX_IMP_KNOCK); // NWN1 VFX
    effect eVis = EffectVisualEffect( VFX_DUR_SPELL_FIND_TRAPS ); // NWN2 VFX
    int nCnt = 1;
    object oTarget = GetNearestObject(OBJECT_TYPE_TRIGGER | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nCnt);
    while( GetIsObjectValid(oTarget) && (GetDistanceToObject(oTarget) <= 30.0) && GetTrapDetectable(oTarget) ) // 8/1/06 - BDF: added GetTrapDetectable check
    {
        if(GetIsTrapped(oTarget))
        {
            SetTrapDetectedBy(oTarget, OBJECT_SELF);
            ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(oTarget)); // DURATION_TYPE_INSTANT will cause only the impact SEF to play, which is OK in this case
            DelayCommand(2.0, SetTrapDisabled(oTarget));
        }
        nCnt++;
        oTarget = GetNearestObject(OBJECT_TYPE_TRIGGER | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE, OBJECT_SELF, nCnt);
    }
}[/nwscript]

When I compile the script, it fires an error in 'nwn2_inc_spells' at line 753-754  (which has to do with MeteorStormBehavior...or something like that).  It continues to fire the error even if I revert the script to its previous state.  This confuses me.  Any advice?

#2
Jeddia

Jeddia
  • Members
  • 17 messages
Here is the advanced compiler report. I've bolded what seems to be the main problem:

Information: Compiler diagnostics for script nw_s0_findtrap:
Warning: x2_inc_switches.nss(717): Warning: NSC6023: Function "SetExecutedScriptReturnValue" argument "nValue" default value does not match the initializer value for a previous declaration. The first declaration value will be used.
Warning: x0_i0_enemy.nss(586): Warning: NSC6023: Function "CheckEnemyGroupingOnTarget" argument "fDistance" default value does not match the initializer value for a previous declaration. The first declaration value will be used.
Warning: x0_i0_anims.nss(1300): Warning: NSC6023: Function "AnimActionPlayRandomGreeting" argument "nHDiff" default value does not match the initializer value for a previous declaration. The first declaration value will be used.
Error: nwn2_inc_spells.nss(753): Error: NSC1020: Undeclared identifier "GetRightLocation"
Error: nwn2_inc_spells.nss(754): Error: NSC1020: Undeclared identifier "GetLeftLocation"
Warning: ginc_crafting.nss(573): Warning: NSC6023: Function "GetIsItemPropertyAnUpgrade" argument "nDurationType" default value does not match the initializer value for a previous declaration. The first declaration value will be used.
Error: Compilation aborted with errors.

#3
Surango

Surango
  • Members
  • 307 messages
I just pasted your script in the toolset and it compiled just fine. What version of nwn2 are you running? What expansions, if any?

#4
kevL

kevL
  • Members
  • 4 078 messages
plus,

Those functions GetRight/LeftLocation, are used in ExecuteDefaultMeteorSwarmBehavior() in 'nwn2_inc_spells'

They come from 'x0_i0_position'

Undeclared identifier seems to mean that a variable/constant, or in this case a function that returns a variable, is undeclared and so the compiler doesn't know what to do. Try adding

#include "x0_i0_position"

where the functions look fine to me, directly to 'nwn2_inc_spells'. Note that GetLeft/RightLocation are NwN2 functions, added by 'BDF' in 2006. So if somehow an older NwN1 'x0_i0_position' is getting referenced they (probably) won't be there.



Or, The possible offenders in 'nwn2_inc_spells' involve these lines:

728: void ExecuteDefaultMeteorSwarmBehavior( object oTarget, location lTarget )
736: location lAhead, lBehind, lLeft, lRight, lFlankingLeft, lFlankingRight, lAheadLeft, lAheadRight;
753: lRight = GetRightLocation( oTarget );
754: lLeft = GetLeftLocation( oTarget );


- am find no trouble with the defaults ( not these ones )

#5
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
or rather the advanced compiler is referencing the wrong includes. Less a scripting issue and more of how to use skywings compiler i'd guess.

Try using the toolset version of skywings compiler plugin.

#6
Morbane

Morbane
  • Members
  • 1 883 messages

painofdungeoneternal wrote...
Try using the toolset version of skywings compiler plugin.


unless you're ripping up the carpet this is the way to go :whistle:

#7
Jeddia

Jeddia
  • Members
  • 17 messages
KevL, you were dead on. I copied 'x0_i0_position' from a virgin module and overwrote the one in my module, and it solved everything... I must've somehow overwrote it while importing .erfs from NWN1. Good eye, man! Thanks. Problem eradicated. I'm sure I'll be back before long...

#8
kevL

kevL
  • Members
  • 4 078 messages
yep ;)