Jump to content

Help with a script...


SGTbayk47

Recommended Posts

Hi all,

 

Whilst working on my mod, I tried to create a script to repair some pipes, and display the appropriate message afterwards.

 

The script I have written (see below) successfully removes the leak, gives the player xp and makes the pipe unable to be activated again afterwards (yay!) however I can't get the messages to show up once, or even at all in some cases.

 

Here's the script for reference:

SCN CanyonSpringsPipeLeakScript

Ref Leak
Short Button
Short PipeDamaged

Begin OnActivate Player

ShowMessage CanyonSpringsPipeLeakMessage01

End

Begin MenuMode 1001

Set Button to GetButtonPressed

If Button == 0 && Player.GetAV Repair >= 40
   Set Leak to GetLinkedRef
   Leak.Disable
   Leak.MarkForDelete
   Set CanyonSpringsTownQuest.PipesFixed to CanyonSpringsTownQuest.PipesFixed + 1
   Set CanyonSpringsTownQuest.DaysLeft to CanyonSpringsTownQuest.DaysLeft + 1
   RewardXP 40
   SetDestroyed 1
   If CanyonSpringsTownQuest.PipesFixed == 3
      ShowMessage CanyonSpringsPipeLeakMessageFixed
   Else
      ShowMessage CanyonSpringsPipeLeakMessageSuccess
   Endif
Elseif Button == 0 && Player.GetAV Repair < 40
   If PipeDamaged == 0
      Set CanyonSpringsTownQuest.DaysLeft to CanyonSpringsTownQuest.DaysLeft - 2
      Set PipeDamaged to 1
   Endif
   ShowMessage CanyonSpringsPipeLeakMessageFailed
Endif

End

The messages I'm trying to display each give a different problem:

  • The failed message does not appear at all when you fail the repair check.

 

  • The success message doesn't display when you first fix a pipe, however when you activate another pipe the message displays. Once you press ok on this message the original shows up again. However when you successfully repair the second pipe the success message shows up and gets stuck in an infinite loop.

Hopefully I have made a simple rookie mistake and someone knows how to fix it, any and all help will is greatly appreciated.

 

Thanks, BayK.

Link to comment
Share on other sites

I could be wrong but you might need a button reset line. Think it was something like

 

if Button == -1

return;

elseIf Button == 0 && Player.GetAV Repair >= 40
Set Leak to GetLinkedRef

 

There is an issue with button presses that messes up if I recall.

 

Good luck,

Geoff

Link to comment
Share on other sites

  • Recently Browsing   0 members

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