Couple of scripting issues...

Post » Fri Dec 25, 2009 1:12 am

I'm just beginning to learn how to script, and one particular problem has me at my wits' end. I've added a script to a vanilla NPC who didn't have one originally. It's basically just a copy of the vanilla 'WaitOneDay' script, but without the NoLore part:

Begin hl_SuraneScriptshort currentDayshort localdaysPassedif ( currentDay != Day )	;assume that the day has gone up, not down or something...	set currentDay to Day	set localdaysPassed to localdaysPassed + 1endifEnd hl_SuraneScript


I then use a dialogue entry to reset localdaysPassed to 0 at the appropriate time, so that the counter can start from there. Only trouble is, when I test it out in game, I get an error message saying that it can't find the 'localdaysPassed' variable - even though it's right there in the script. Even more confusingly, I've added the same code to another NPC's script and it works perfectly. Am I missing something really obvious?

I also need to find a way to disable the Hlaalu guards in the Caldera mine and replace them with Redoran ones. I can't do it through dialogue or local scripts as they don't have a unique ID. Can anyone tell me the most efficient way to do this?
User avatar
Aliish Sheldonn
 
Posts: 3487
Joined: Fri Feb 16, 2007 3:19 am

Post » Thu Dec 24, 2009 8:55 pm

When do you get that error - at the loading game, when you enter the cell where the NPC is, when you click a topic that resets localdaysPassed, something else?

You want to disable Hlaalu guards at a certain moment of the quest, something like Redoran invasion? I'm afraid the only way to do that is to edit Caldera mines, remove all vanilla guards completely and replace them with your own version of Hlaalu guards with a script working like you need. Which may or may not produce a bugless result. There's MWSE/MGE, of course,but since you're just starting scripting, it's going to be somewhat over your head for the time being.
User avatar
Steph
 
Posts: 3469
Joined: Sun Nov 19, 2006 7:44 am

Post » Thu Dec 24, 2009 8:52 pm

When do you get that error - at the loading game, when you enter the cell where the NPC is, when you click a topic that resets localdaysPassed, something else?

When I click the topic that resets localdaysPassed.

You want to disable Hlaalu guards at a certain moment of the quest, something like Redoran invasion? I'm afraid the only way to do that is to edit Caldera mines, remove all vanilla guards completely and replace them with your own version of Hlaalu guards with a script working like you need. Which may or may not produce a bugless result. There's MWSE/MGE, of course,but since you're just starting scripting, it's going to be somewhat over your head for the time being.

OK, I'll do it that way. I don't want to make the mod dependent on MWSE/MGE, so that's not an option.
User avatar
dell
 
Posts: 3452
Joined: Sat Mar 24, 2007 2:58 am

Post » Thu Dec 24, 2009 6:20 pm

Are you sure that you were talking to an NPC that has your script attached? Before talking to him, call the console, click on him so that his ID must be console window's header, and type "sv". Normally a list of your local variables should be displayed instead of globals.
User avatar
Anthony Rand
 
Posts: 3439
Joined: Wed May 09, 2007 5:02 am

Post » Fri Dec 25, 2009 7:32 am

Okay, this is getting bizarre. The NPC in question is Surane Leoriane in Caldera, and she definitely has the script attached - I've checked several times in the CS - but the game doesn't seem to recognise it. When I try the 'sv' command on her, I just get a list of global variables. I've tried deleting the old script and making a new one, but it doesn't make any difference.
User avatar
Josh Trembly
 
Posts: 3381
Joined: Fri Nov 02, 2007 9:25 am

Post » Thu Dec 24, 2009 8:20 pm

Okay, this is getting bizarre. The NPC in question is Surane Leoriane in Caldera, and she definitely has the script attached - I've checked several times in the CS - but the game doesn't seem to recognise it. When I try the 'sv' command on her, I just get a list of global variables. I've tried deleting the old script and making a new one, but it doesn't make any difference.



open the console and type

TFH

[TFH = TOGGLE FULL HELP]

under this command, when next to an item, you'll see under its name, also the script attached to it.
If under this command, you do not see any script attached to your npc, means you have to use another save game to test it, or clean that save game,
User avatar
Makenna Nomad
 
Posts: 3391
Joined: Tue Aug 29, 2006 10:05 pm

Post » Thu Dec 24, 2009 7:39 pm

You're right: with my two earliest savegames (out of about 35) the script shows up; with all the later ones, it doesn't. How unbelievably annoying. I wonder what could be causing it?
User avatar
Saul C
 
Posts: 3405
Joined: Wed Oct 17, 2007 12:41 pm

Post » Thu Dec 24, 2009 10:43 pm

Try a saved game that the mod wasn't loaded in to test it. Morrowind doesn't always apply changes in a mod to a saved game that had a previous version installed.
User avatar
Ice Fire
 
Posts: 3394
Joined: Fri Nov 16, 2007 3:27 am

Post » Fri Dec 25, 2009 7:05 am

You're right: with my two earliest savegames (out of about 35) the script shows up; with all the later ones, it doesn't. How unbelievably annoying. I wonder what could be causing it?
Morrowind savegames contain duplicates of some records that were changed in-game - say, NPC's inventory was updated by some items, or his stats permanently drained, etc. If you have updated your mod in the middle of the game and the same NPC's data was chagned (in your case, a script added), the savegame version of the record takes precedence over newly updated one in the mod.

In short - clean your save.
User avatar
OnlyDumazzapplyhere
 
Posts: 3445
Joined: Wed Jan 24, 2007 12:43 am

Post » Thu Dec 24, 2009 9:19 pm

I don't actually have any savegames with the mod loaded, but in any case, deleting Surane's record from my savegame in Tesame fixed the problem. It'll be a problem if the same thing happens when other people play the mod, though. :shrug: Guess I'll keep it as it is for the moment, and see how it pans out in beta-testing later on.

Thanks for your help, guys.
User avatar
victoria gillis
 
Posts: 3329
Joined: Wed Jan 10, 2007 7:50 pm

Post » Fri Dec 25, 2009 4:21 am

Rather than introduce conflicts and whatever problems you are currently experiencing by altering the script on Surane Leoriane you could use a global variable for your dialog filter and use a local script on a hidden activator in her cell to toggle the variable. As little as I like to introduce new globals it is always preferred to mod conflicts and broken quests.

As for the transformation of the Caldera Mine to a Redoran holding I would create a duplicate Caldera Mine cell and place a new door just proud of the existing door that teleports the player to the mine interior. The door is disabled until the player completes the quest that transfers control of the mine to House Redoran, and when it is enabled it teleports the player to the new interior complete with hired miners and Redoran guards. This is a strategy we regularly use with LGNPC mods to avoid conflicts. Should the player require access to the original cell after the fact the door can be easily disabled through the console.
User avatar
~Amy~
 
Posts: 3478
Joined: Sat Aug 12, 2006 5:38 am


Return to III - Morrowind