Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Companion Script Problem


Zaldir
 Share

Recommended Posts

Okay, I am making a Companion for someone, and I've gotten everything to work, except from one part, where the companions is supposed to Stop follow and eventually leave.

After one day, Wasabi is supposed to stop follow, and after 3 days, she'll leave for Border Watch.

The Green part is where the problem is.

SCN GMouseWasabiScript

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;GENERAL VARIABLES

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

short Choosing

short Choice

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;FEEDING VARIABLES

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

short lastFeedDay

short daysDiff

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;FUNCTIONS

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Begin OnActivate

Set Choosing to -1

Set Choice to -1

End

Begin GameMode

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Feed Part

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

set lastFeedDay to GameDaysPassed

;Days Before Wasabi Runs Away

set daysDiff to GameDaysPassed - lastFeedDay

if DaysDiff == 1

Message "Wasabi is hungry, and have stopped following you..."

Set WasabiCom to 3

GMouseWasabiRef.EVP

elseif daysDiff == 3

Message "Wasabi is starving, and have left for Border Watch..."

Set WasabiCom to 4

GMouseWasabiRef.EVP

endif

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Message Part

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

If (Choosing == -1)

messagebox "Wasabi" "Follow" "Wait Here" "Give Carrot" "Give Rice" "Give Wheat" "Give Cheese Wedge" "Give Corn"

set Choosing to 1

Elseif (Choosing == 1)

set Choice to GetButtonPressed

If (Choice == 0)

;Follow

if (WasabiCom == 3) || (WasabiCom == 4)

Message "Wasabi does not wish to follow such a cruel master."

ElseIf (WasabiCom == 2)

Set WasabiCom to 1

GmouseWasabiRef.EVP

set Choosing to 2

Endif

ElseIf (Choice == 1)

;Wait

if (WasabiCom == 3) || (WasabiCom == 4)

Message "Wasabi does not take orders from such a cruel master."

ElseIf (WasabiCom == 1)

Set WasabiCom to 2

GmouseWasabiRef.EVP

set Choosing to 2

Endif

ElseIf Choice == 2

;Carrot

if Player.GetItemCount Carrot == 0

Message "You do not have any Carrots!"

elseif Player.GetItemCount Carrot > 0

Player.RemoveItem Carrot 1

ModAV Agility 1

set lastFeedDay to GameDaysPassed

PlaySound ITMIngredientUp

Set WasabiCom to 1

GMouseWasabiRef.EVP

set Choosing to 2

Endif

ElseIf Choice == 3

;Rice

if (Player.GetItemCount Rice == 0)

Message "You do not have any Rice!"

Elseif Player.GetItemCount Rice > 0

Player.RemoveItem Rice 1

ModAV Strength 1

set lastFeedDay to GameDaysPassed

PlaySound ITMIngredientUp

Set WasabiCom to 1

GMouseWasabiRef.EVP

set Choosing to 2

Endif

ElseIf Choice == 4

;Wheat

if Player.GetItemCount WheatGrain == 0

Message "You do not have any Wheat!"

Elseif Player.GetItemCount WheatGrain > 0

Player.RemoveItem WheatGrain 1

ModAV Endurance 1

set lastFeedDay to GameDaysPassed

PlaySound ITMIngredientUp

Set WasabiCom to 1

GMouseWasabiRef.EVP

set Choosing to 2

Endif

ElseIf Choice == 5

;Cheese

if Player.GetItemCount Cheesewedge == 0

Message "You do not have any Cheese Wedges!"

elseif Player.GetItemCount Cheesewedge > 0

Player.RemoveItem Cheesewedge 1

ModAV Fatigue 1

set lastFeedDay to GameDaysPassed

PlaySound ITMIngredientUp

Set WasabiCom to 1

GMouseWasabiRef.EVP

set Choosing to 2

Endif

ElseIf Choice == 6

;Corn

if Player.GetItemCount Corn == 0

Message "You do not have any Corn!"

elseif Player.GetItemCount Corn > 0

Player.RemoveItem Corn 1

ModAV Speed 1

set lastFeedDay to GameDaysPassed

PlaySound ITMIngredientUp

Set WasabiCom to 1

GMouseWasabiRef.EVP

set Choosing to 2

Endif

Endif

Endif

End

Link to comment
Share on other sites

For starters, you are setting lastFeedDay to the current day, every single execution frame. So, DaysDiff will never be equal to 1 since it will always be equal to the current game day set just above it.

Another note here. Even if Wasabi was fed at 11pm, at midnight, a new day, she will run away since the last feed day was the 'previous day'. You might want to take into account the time of the last feeding too. Or make it 2 days.

Link to comment
Share on other sites

When your companion is fed, that is when you set the variable lastFeedDay. Not every frame like you have it.

If the feeding is done somewhere else, you may want to use a global or quest variable to store the date and time of feeding.

I have no idea how you have it all set up so I could not help more than that. Plus, I am no good at all with quests or dialoge. Just scripts...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...