Jump to content

Recommended Posts

I'm adding some vendors to the IC Market District. Since I'm super lazy, I want these vendors to simply be disabled at night, and enabled during the day when open for business. I'm a complete dunce when it comes to scripting, but I thought this would be pretty simple. But I can't get it to work right.

 

I have the NPC in game, with the "Initially Disabled" box checked. Here is the script attached to his reference:

scn JFICMarketPriestScript

short doOnce

Begin GameMode
	
	If GameHour >= 8 && GameHour <= 20
		If doOnce == 0
			JFICMarketPriestREF.enable		
			set doOnce to 1
		endIf
	endIf

	If GameHour > 21
		If doOnce == 1
			JFICMarketPriestREF.disable
			set doOnce to 0
		endIf
	endIf			

End

It compiles fine and all, but seems to have no effect. I've tried having the NPC enabled or disabled to start, and he stays in either state irrespective of game time. If anyone could tell me what I'm doing wrong, I would really appreciate it. (And I'm sorry if my code is horrific, I really do not "get" scripting very well.)

Link to comment
Share on other sites

Hm... well, if I remember correctly scripting for Oblivion is very similar to New Vegas, so you could try this script I use in one of my NV mods. Really simple so it may work for you. It needs to be linked to a quest that starts game-enabled.


Begin GameMode	
  if GameHour >= 18 || GameHour < 7	
     NPCMarkerREF.enable	
   else	
     NPCMarkerREF.disable 
EndIf
END

Hope it helps :)

Link to comment
Share on other sites

Edit: Nevermind, I had made some wrong assumptions, and was thankfully corrected by someone more knowledgeable (thank you!). My bad, sorry. :blush:

 

Edit 2: To add back the relevant pieces I deleted (leaving out the irrelevant false assumptions about scripts on disabled references), the script by Jokerine looks like valid Oblivion scripting. And if you run into any similar issues later, you can always temporarily add some messageboxes or other printing to your scripts to track where the script goes. For example:

MessageBox "It is night, disabling the NPC."
MessageBox "It is night, the NPC is already disabled."
MessageBox "It is day, enabling the NPC."

There are also command to print to the console, but those seem to all require OBSE according to the wiki (like PrintToConsole, PrintD, DebugPrint and the like).

Edited by Contrathetix
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...