Help needed in blending two scripts

Hi everyone,

Normally when I try to blend scripts I can after many tries of experimenting - generally am able to blend two scripts together…except these two. I need these two blended for my OnClientEnter event script. I am trying to add the prestige class from the vault called the “Foe Hunter” found here:

https://neverwintervault.org/project/nwn1/hakpak/foe-hunter-prestige-class

Man…not sure if the feats even work…I got everything in there…but now I noticed on his sample mod he had this script “on enter” on his OnClientEnter event script to call from…so need to blend this script with my own…help…can’t seem to compile a working script.

See attached

on_enter.txt (2.1 KB)
oncliententer.txt (1.9 KB)

Just put ExecuteScript("on_enter", OBJECT_SELF); in your oncliententer script. You can just put it on the line after initPortable(oPlayer);.

That’s often the simplest way to handle this sort of thing.

Hi meaglyn,

Thanks for answering. I am no scripter here. I normally just fidget (i.e…put brackets in between two scripts I am trying to merge) and sometimes it works…lol.

But not sure what you mean above. Could you blend them for me to show me what you mean. I will use that as an example for on the other script I need to blend too that came in the sample module.

Put the exact ExecuteScript text from my earlier post on a new line below initPortable… and above
the } in your current oncliententer.nss script.

Then make sure to put the on_enter.nss script in your module and compile at least those two scripts.

I’m sorry…frustrated here…tried so many ways to implement what you said above. You are talking like I know how to script…I don’t…lol

Here is my last effort attached still not compiling. It is the mix of the two above (the originals)

OnClientEnter9.txt (4.1 KB)

...
    initPortable(oPlayer);

 ExecuteScript("on_enter", OBJECT_SELF);
}

That’s the end of the file.

Do not include the text of the on_client.nss script below here.

Just, and only, add the one line to the oncliententer.nss script which I posted above and in my first reply.

I’m sorry meaglyn,

I am an imbecile…lol…I think you are so advanced in scripting that when you are trying to help me…you assume I know scripting…I don’t.

Let me see if I can find out what you are saying here.

I’m not sure how both are to be meshed together. I am ASSUMING…that you want me to put this bit you put above at the bottom of both scripts that are merged together?..correct? If so…what do I put BETWEEN both scripts when I merge them? I’m sorry man…I just don’t get what you are saying and feeling dumb…I am a visual learner.

@Imtherealthing - I think @meaglyn means something like this (I had to change the lines with the description of the script at the top since it looked really odd here when posting the script in this post):

/*
Default On Enter for Module
 x3_mod_def_enter
Copyright (c) 2008 Bioware Corp.


     This script adds the horse menus to the PCs.


Created By: Deva B. Winblood
 Created On: Dec 30th, 2007
Last Update: April 21th, 2008

*/

#include "crp_inc_control"
#include "x3_inc_horse"
#include "sd_portable_inc"
#include "blsg_h"
#include "prc_spellswd"

void main()
{
    SpellOnEnter();
    BladeSingerModuleOnEnter();
    ExecuteScript("prcl_clnt_entr", OBJECT_SELF);
    ExecuteScript("harperonenter",OBJECT_SELF);
    ExecuteScript("bp_pal_enter",GetEnteringObject());
    object oPC=GetEnteringObject();
    ExecuteScript("x3_mod_pre_enter",OBJECT_SELF); // Override for other skin systems
    ExecuteScript("cdj_nj_setup", oPC);
   if ((GetIsPC(oPC)||GetIsDM(oPC))&&!GetHasFeat(FEAT_HORSE_MENU,oPC))
    { // add horse menu
        HorseAddHorseMenu(oPC);
        if (GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB"))
        { // restore PC horse status from database
            DelayCommand(2.0,HorseReloadFromDatabase(oPC,X3_HORSE_DATABASE));
        } // restore PC horse status from database
    } // add horse menu
    if (GetIsPC(oPC))
    { // more details
        // restore appearance in case you export your character in mounted form, etc.
        if (!GetSkinInt(oPC,"bX3_IS_MOUNTED")) HorseIfNotDefaultAppearanceChange(oPC);
        // pre-cache horse animations for player as attaching a tail to the model
        HorsePreloadAnimations(oPC);
        DelayCommand(3.0,HorseRestoreHenchmenLocations(oPC));
    } // more details
      DeleteLocalInt(oPC,"pr_speaking");
      DeleteLocalInt(oPC,"pr_language");
{
 }
    object oPlayer = GetEnteringObject();

    initPortable(oPlayer);
	ExecuteScript("on_enter", OBJECT_SELF);
}

@Imtherealthing If you check the script, the only thing I’ve done (which was what @meaglyn was trying to instruct you to do, I believe, is to just add the line ExecuteScript("on_enter", OBJECT_SELF); below the line with initPortable(oPlayer); . Do you see it?

By the way, to post a script here so that everyone can read it easily just put ```C above the script and then the same thing but without the “C” below the script. Hope that helps.

@Imtherealthing

@meaglyn is explaining that you can execute the “on_enter” script separately rather than try to merge it directly into the script.

I note from @andgalf posting of a script (a version of yours?) that you already do this for other scripts in lines that use the same ExecuteScript function. Therefore, the argument would be the same for your “on_enter” script to use the same ExecuteScript function to execute your new “on_enter” script just after these ones in your current OnClientEnter script.

EG:

ExecuteScript(“prcl_clnt_entr”, OBJECT_SELF);
ExecuteScript(“harperonenter”,OBJECT_SELF);
ExecuteScript(“bp_pal_enter”,GetEnteringObject());

ExecuteScript("on_enter", OBJECT_SELF);

object oPC=GetEnteringObject();
ExecuteScript(“x3_mod_pre_enter”,OBJECT_SELF); // Override for other skin systems
ExecuteScript(“cdj_nj_setup”, oPC);

BUT …

That all said, the script looks very awkward and I suspect does not compile in its current state. That is also quite a lot of “executions” one after the other that may require some attention to ensure events are executing at the best times.

My suspicion is that your requirements may have outgrown your current knowledge, even with basic use of the ExecuteScript function, and maybe it’s time to consider learning a bit more about scripting. Believe me, once you grasp the basics, you won’t look back. :slight_smile:

I have written one such tutorial that you can take a look at. Bear in mind, I knew nothing about scripting at the start, and so it starts from that point of view: that you know nothing. I am sure others can suggest other tutorials too. The point being, once you have grasped some basic understanding, any suggestions put to you will start to make more sense to you too:

https://neverwintervault.org/project/nwn2/other/scripting-tutorial-beginners-nwn2

EDIT: Also, this post would have been better placed in the “Scripting” forum. You can edit your post and move it to the correct forum if you want more scripting attention.

@Lance_Botelle @Imtherealthing - Also, Imtherealthing, I’m not sure which game you are working with. Is this for NWN1, NWN EE or NWN2?

@Lance_Botelle - I only copied his script that he posted in the first post here and added the line with the ExecuteScript.

1 Like

Sorry. I don’t know how else I would say that. I was not assuming you know anything about scripting, just that you could read what I posted and edit your file. Which you can clearly do. I told you twice exactly what to do. Put this one line right here, done. Not really any scripting knowledge needed or assumed…

You are making it more complicated in your head than it needs to be. I can’t really do anything about that…

@andgalf has it right. And I was not trying to get into fixing up any of the other issues in the script. It does not have to be elegant, just has to work.

And yes, it could have gone up with the other executed scripts. It’s stand alone from what I could see so the order doesn’t matter. I thought it would be easier to explain just putting it at the end. I was mistaken :slight_smile:

I’m stupid…lol

Oh…I think I might understand now… Lance_Botelle…that script above is going to call the script seperately…not needed in there…ok…I will try it…thanks all…dam I feel soooo stupid…lol

1 Like

OMG…after re-reading all this AGAIN…I feel so incredibly STTTTUUUPPPPIIDDD…

I kept thinking…you guys were just not understanding I need both meshed together…instead…you just wanted that end part to call on the other script…DUH…my greatest apologies and MANY THANKS for your help and patience with moronic oaf that I am…lol…thanks guys…I should use a new name here…just call me:“ImTheDUHguy”…lol

meaglyn…you hit it right on the head with your first comment…I just could not “SEE” it…dam…so sorry bud…I had you doing all this and thinking…this guy is retarded…lol…I have never done a script where it called on another script…my first experience…I normally blended scripts together…thanks man

Ok with the example above…I used the similar approach to add the same sort of script to my OnPlayerLvUp module event script.

I add the attached script titled: “on_level” to my existing OnPlayerLvUp script in the same manner. See both scripts…at the end I just added the line:

ExecuteScript(“on_level”, OBJECT_SELF);

It compiled…BUT will it work as intended? Or will it mess with my ninja stuff listed on that script?

on_level.txt (2.1 KB)
OnPlayerLvUp.txt (1.1 KB)

I can’t state enough here how grateful I am to you all for your help…THANKS GUYS!!!

2 Likes

Bummer…all this work…and it seems that the presitige class: “Foe Hunter” feats are not working…see link above :frowning:

No. I never thought that and I don’t think you are stupid :slight_smile: No worries. Glad you got it going. I’ll take a quick look at the other set you posted and comment.

2 Likes

The on_level scripts look like they should work as you have them as far as the ExecuteScript() part goes.

I do notice that you are using a totally different set of numbers for the feats in the on_level script than in the on_enter script. On_level has feats 24771 and up (which is really high for feats.2da) and the on_enter has 1073 and up (which seems more reasonable). Those numbers need to match and need to match the new feats you have added to your feats.2da.

I don’t know if that is causing whatever makes you say they are not working but making sure that is right is probably the next step…

1 Like