Jump to content

Need some help understanding scripts and x-markers


MonoAccipiter

Recommended Posts

Hi, guys!

 

For a while now I've been working on a small mod improving a bit on Mike Hancho's New Bison Steve mod, mostly in terms of lighting, but also a lot of other small changes to improve upon its asthetics (+ some new features, like a working crafting oven in Buck's Place and light switches)

 

The issue is that when adding my additions in the hotel to the appropriate X-Markers (so they won't appear at the wrong stages) they simply won't show up on my character that has already completed the quests, and I was thinking this had to do with the script enabling the x-markers or something similar. That's when I discovered that the original mod had a "dummy quest" called Bison Steve Updater and found out that the related quest script checks for whether the main quest is completed and enables a lot of markers. Now I've done no scripting at all beyond creating a simple light switch script, but I do recognize this script runs during gamemode, and thought I could maybe hijack it to help implement my features at the right times as well.

 

It looks something like this:

scn BucksQuestCheckScript

begin GameMode

	If GetQuestCompleted BucksGrandOpeningQuest
		SetStage BucksRebuildQuest 100
		SetStage BucksBisonSteveQuest 100
		SetStage BucksGrandOpeningQuest 100
		;SetObjectiveDisplayed BucksQuestCheck 10 1
		BucksEnableGiftShopREF.Enable
		BucksEnableDesk.Enable
		BucksNPCSteveREF.RemoveItem OutfitMerc03 1
		BucksNPCSteveREF.AddItem OutfitTenpenny 1
		BucksNPCSteveREF.EquipItem OutfitTenpenny 0 1
		player.additem BucksDoorPassword 1
		BucksNPCAnnaREF.enable
		BucksAnnaTriggerForceGreetREF.disable
		BucksStage03REF.Enable
          BucksWallTerminal.Enable
          StopQuest BucksQuestCheck
	Endif
End

However, if I try to add something like BucksLightingMarkerREF.enable and BucksRestEquipREF.enable at the end of the innermost block of code, the new additions I tied to those markes still won't show up, and I'm honestly at a loss as to why. If anyone here has encountered a similar issue and could offer some assistance, that would be greatly appreciated.

 

For the record the markers are set to be initially disabled as to not have the items show up in previous stages, and I've also had this problem occur and force me to shelve another mod I made which added gamblers to the Vikki & Vance.

 

~Mono

Link to comment
Share on other sites

A REF whose enable parent is initially disabled only gets enabled when the parent REF's enable state changes. If the parent ref was already enabled before the mod with the child was loaded, the child won't be enabled unless something disables and re-enables the parent. Your best bet is to make one of your new objects the parent of the others, and enable it based on the enable state of the existing REF you would have otherwise made the parent. You can do that in a quest script as shown, or in the OnLoad block of the object itself, if it has a script attached.
Link to comment
Share on other sites

I see!

 

So I guess the best way of making sure that:

  1. The features get enabled on the correct stages, and:
  2. It would be possible for me to add further features to the mod that would continue to adhere to 1, would be to:

Create a intially enabled x-marker, which I can disable via a quest script and connect objects to it set to have the opposite enable state of the parent, or would that just result in the same effect? Cause if I do as you suggested won't that lead to me requiring a new script everytime I make a new addition?

Edited by MonoAccipiter
Link to comment
Share on other sites

I believe the same thing happens even if you set the opposite from parent flag (that is, the child's enable state still only updates when the parent's enable state changes). However, disable & re-enable the parent should force all children to be enabled regardless. So, you would only need to change one line in the quest script when you add new children:

BEGIN GameMode

if ActualTargetREF.GetDisabled == 0
   if MostRecentlyAddedChildREF.GetDisabled    // change this with each update
      ParentREF.disable 0
      ParentREF.enable 0
   endif
endif

END

If you do it in the OnLoad block of one of the object scripts instead of a quest script, you could probably remove the GetDisabled check on the most recently added child, and therefore the script wouldn't need to change at all when you add features. This would disable & re-enable the parent & all children every time the cell loads, but A) it should all happen in the same frame and B) it will probably happen while the loading screen is still displayed, so there shouldn't be any visible flickering under normal circumstances.

BEGIN OnLoad

if ActualTargetREF.GetDisabled == 0
      ParentREF.disable 0
      ParentREF.enable 0
endif

END
Link to comment
Share on other sites

Bear in mind that OnLoad blocks won't re-trigger if the object is still in memory. This drove me nuts when I was working on some lighting.

 

You can use linked refs and set new ones with Lutana's SetLinkedRef if you want to add new ones.

Link to comment
Share on other sites

Sorry for being a bother but i wrote this script in its own quest (as I'm still unsure whether the endquest command in the other script makes it so the script only runs once, which means adding to it won't do anything):

scn NNBSUpdateScript

BEGIN GameMode

if BuckRestEquipREF.GetDisabled == 0
	if NNBSSmoke02.GetDisabled
		BuckRestEquipREF.disable 0
		BuckRestEquipREF.enable 0
	endif
endif
if BucksLightingMarkerREF.GetDisabled == 0
	if NNBSChandelier03.GetDisabled
		BucksLightingMarkerREF.disable 0
		BucksLightingMarkerREF.enable 0
	endif
endif

END

And it won't let me save because BucksRestEquip in line 7 (and by that nature, 8, 13 and 14) is an invalid reference. Geck PowerUP also said "only object references and reference variables are allowed in this context"

Not really sure what you meant RoyBatterian, could you provide an example? I've never scripted anything before this so I'm afraid I'm a bit of a scrub. :S

Edited by MonoAccipiter
Link to comment
Share on other sites

Correct - StopQuest BucksQuestCheck at the end of the script means it will only run once (plus changing that script would probably conflict with other mods that do similar expansions and any future updates to New Bison Steve itself, so creating a new script to add your features is definitely the way to go). I'm not familiar with the scripts for New Bison Steve, but it looks like everything else in your examples is prefixed with Bucks* so the compiler error may just be a missing "s" in the ref name (presumably BucksRestEquipREF).

Link to comment
Share on other sites

Haha, I feel so incredibly stupid now. Thanks.

 

Now I need to figure out how I select it as the quest script. :S

 

EDIT: Also, more of a general question, I read on the GECK page that having scripts running all the time is less than ideal, so is there any other way to make sure any future updates I add is added as well, without the scripts running constantly, beyond me deleting and making a new quest every time I update it (which I assume wouldn't be that good either)?

 

EDIT2: It seems I've encountered a bug. I can't select any scripts in the field for scripts in GECK and whenever I change the tab in the quest making interface, the changes I made in the first tab disappear. I also have this issue, but I'm on Windows 10 so I have no idea what might fix it. (I can live with the last issue though, since you can drag the division bars back).

 

EDIT3: It seems I need to save the quest, then open it up again to get the lists to work, my bad haha. :)

Edited by MonoAccipiter
Link to comment
Share on other sites

scn NNBSUpdateScript

BEGIN GameMode

if BucksRestEquipREF.GetDisabled == 0
	if NNBSSmoke02.GetDisabled
		BucksRestEquipREF.disable 0
		BucksRestEquipREF.enable 0
	endif
endif
if BucksLightingMarkerREF.GetDisabled == 0
	if NNBSChandelier03.GetDisabled
		BucksLightingMarkerREF.disable 0
		BucksLightingMarkerREF.enable 0
	endif
endif

END

I added this as a quest script to my own quest as shown in this picture:

 

http://i.imgur.com/dPf969Z.png?1

 

But my changes still won't appear. Any idea what might have gone wrong?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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